mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Math (https://www.mersenneforum.org/forumdisplay.php?f=8)
-   -   Problem with determining squareroots in the progressions.. (https://www.mersenneforum.org/showthread.php?t=849)

Annunaki 2003-07-18 18:02

Problem with determining squareroots in the progressions..
 
Well may be i even can`t formulate my problem in short statement, because of my high-school level knowledge in math and my bad knowledge in mathematical terms in english, but i will try to describe my problem..
But first little bit about me.. Time by time i am returning to my ideas in factoring and trying to write simple algorithms in factoring and finding primes.. Because of lack of knowledge I can`t even estiminate how eficient they are but i know that they aren`t too eficient..
On one of my ideas i met the problem of determining when a sum of certain arithemtic progresiion will be equal to some natural n^2..
thus for example I know the first element in arithmetic progresion is n..
every next element is increased by 2.. the question is can modern math easily tell when the summ of hole chain will be some natural number n^2..
for example-
let the first element be 31
so the second will be 31+2=33
31+33=64 and that is 8^2..
in this example we are lucky and we need to do only one addtion and we have some natural n^2..
but some other examples can illustrate that we may need a lot of more...
i have some ideas how to do this, but every time it needs a lot of cycles(time) with large numbers...

Orgasmic Troll 2003-07-18 20:32

I don't know if you want a general case, but if the constant is 2 (such as the example you gave), then the sum of [i]k[/i] terms is k^2 + k(n-1), if that helps any

Orgasmic Troll 2003-07-18 21:44

I've been playing around a bit with this .. for n where n==3 mod 4 (n leaves a remainder of 3 when divided by 4), when the sequence reaches (n-1)^2/4 then the sum of those terms is square. This isn't necessarily the soonest it sums to a square, but it always does

for n==1 mod 4, the sequence is a square when it reaches (n-1)^2/8 + 1, again, this isn't always the smallest answer.

So that takes care of the odd numbers .. haven't really looked into even numbers much

I sort of worked this out as a visual proof, if anybody is really interested, I can try to put it together up here, and if not, I sure won't mind not having to.

Orgasmic Troll 2003-07-18 21:53

for n even, the number of steps is (n-2)^2/4 - 1

ET_ 2003-07-18 23:19

It seems the opposite of the 3x-1 problem.

3x-1 chains seem to always decade into a 2^x loop.

Luigi

cheesehead 2003-07-19 00:25

Re: Problem with determining squareroots in the progressions
 
[quote="Annunaki"]my high-school level knowledge in math[/quote]
How much algebra have you studied in school? (I ask because it could help us respond.)

[quote]the question is can modern math easily tell when the summ of hole chain will be some natural number n^2..[/quote]
Yes.

In order to figure out the efficiency of your algorithms, you will need to use the properties of, and methods of analyzing, mathematical series and sequences. In some schools this is included in first-year algebra; in other schools, later.

Maybe an online math instruction site could help you. Here is one: [url=http://www.ilovemaths.com/3.htm]http://www.ilovemaths.com/3.htm[/url]

Annunaki 2003-07-19 09:01

About my level of math.. As i learned in trade technikal school the level of math was definitely not good.. However I have allways learned math for my self buy finding my own problems and trying to solve them..
In other words do not expect me to understand expressions fo high level math.. I just don`t know the syntax of that "high" math.. But i will try to understand whar you mean if you will explain me it.. For example I do`nt know if I understand correctly that mod expressions.. for example:
n==3 mod 4 does that meens that if you divide n by 4 you will allways get 3 in reminder or in other word your result will be some notural n + 0.75?..
.. and form your replies "when the sequence reaches (n-1)^2/4" i don`t think i understad this..
aslo i don`t understand what you mean with 3x-1 problem..
sorry i know my knowlegde in math is awfull.. i just like to write my algorithms and solve diferent problems.. I just haven`t read many abaout the math and problems in there.. may be it also good, because if your mind is filled with other ideas and thoughts, may be you can`t find yours anymore{just my opinion you may try to disagree with that}
Also I know how to get the sum of such progressions i described.. I just don`t know how te easely determinete when such sum will be some natural n^2..
More than that.. does any of you know have mathemathic still some problems with chains and calculating sum of chains..
for example i have a chain first eleent is 6.. diferential is 9 but it increases by 9 every time..
for example the sum of such chain if it consist of:
1 element = 6
2 elements = 6+6+9= 21
3 elements = 21+6+9+9=45
4 elements = 45+6+9+9+9=78 etc..
so question is can math easely calculate the sum of such chain wih n elements, because i think i can do it and i can even give a formula..
another example could be chain wich elements is all natural n^2 starting with 1.. and the sum of this chain would be the sum of all natural n^2 form 1 to some natural K.. of course summing all natural n together isn`t the most efficient way to calculate the sum of such chain.. if you are interested i can even give my formula.. but i doubt if my so called formulas is needed cause i assume math has gone far far beyond my imagination these days, and may be this what I describes is not a problem allready for n years..
However this is only additional question.. main question remains about the squareroots..
If you can tell me the way with which i can precisely tell when the
sum of chain where first element is natural n the second is n+2 the third n+4 etc. will be some natural n^2 then i think factoring of even large numbers can be done in few seconds.. But this is only if you can tell me the method with which you can precisely tell how much elements i need in that kind of chain (of course the element number will differ in diferent chains but..) to sum of this chain be some natural n^2..

Annunaki 2003-07-19 09:05

yes about my education may be I have mistaken.. I thought the high-school level corresponds to one level higher level than primary education.. Is it so? Well this year i hope i will already student of University of Latvia..

Annunaki 2003-07-19 17:02

I am sorry but I forgot to mention one thing about that progression..
In overal it is normal arithmethic progression with first element(natural n) and diferential 2, except that it has anoher integer(element) before other element that make arithmethic progression.. this (we could call it 0th element) is independent from other elements of progression and only thing that i can say about it is that it is allways less than first element of chain by at least 3..
here is an example of such chain..
14; 51; 53; 55; 57; 59; 61; etc..
here we can see that summ of first 6 elements is(or 5 if we count 14 as )th element) 289 which is 17^2 which is exactly what we needed to find in this case...

dsouza123 2003-07-20 15:24

High school is usually grades 9,10,11,12
Some students instead go to a Vocational ( Technical ) High School also usually grades 9,10,11,12

University/College (Bachelors/Associate degree)/Technical school follows.

======= Back to the math. ================

The series consisting of the sum( addition ) of consecutive odd numbers
( starting with 1 ) results in (perfect) square numbers.

Since it is the sum consecutive odd numbers each number in the series is an increase of 2 from the previous number in the series.

Example
1+3= 4 1+3+5=9 1+3+5+7=16 etc.

If k = count of odd numbers in a section of the series
( k = count of numbers summed )
Then k^2 = sum(1..count)

Example
1+3+5+7=16 so k=4 and k^2=16



For mod it is the remainder after integer division

Using div to represent integer division

Example n = 23 n div 4 = 5 with a remaider 3 so n mod 4 = 3
for integer math numerator DIV denominator = result div

n = result div*denominator + remainder
23 = 5*4 + 3

if it wasn't integer math then
n = 23 n / 4 = 5.75

Annunaki 2003-07-20 17:49

I know that perfect squares or every natural n^2 is the sum of arithmethic progression of n elements where first element is 1 but every ext is increased by 2..
But my question is wether you can determinate when the sum of arithmethci progression is some natural n^2 or better how many elements you will need in arithmethic progression to it`s sum to be some natural n^2.. I know it is easy to tell this if first element is 1 and every next +2(because then in all cases sum offirst n elements of chain will be n^2), but in my case the fist element is never 1.. Although afetr the fisrt element every next is increased by 2(like in the case with that "perfect square string") it is not so easy to tell how many elements you will need in this chain to sum of this chain be some perfect sqare.. Actually i haven`t jet found a better way than just to add +1 element and check every time if now the sum of chain is some natural n^2.. but that is very slow and unefective.. i need better ways.. I have som ideas, but i just thought may be somene else has faced this problem and found some better solutions than me..

dsouza123 2003-07-21 02:38

If your initial number = i and final number = f
i and f are boundary values of a series of consecutive odd numbers then

sum = ( i + f ) / 2 * ( h - i + 2 ) / 2

i = 25
f = 29
sum = (25+29)/2 * (29-25+2)/2
sum = 27 * 3
sum = 81

It will work even in trivial cases

i+2 = f
i = 17 f = 19 --> 36

i = f
i = 9 f = 9 --> 9

You still have to determine if this sum is a perfect square.

There are tests that will eliminate a number as a perfect square
( if it isn't eliminated then it is a possible perfect square )

Other than doing a square root, squaring, then comparing
I don't know any test that determines a number is a perfect square.

Mapping the sum to the series 1..Z of odds would be another
but the trick is to do the mapping.

Will it involve more computations then the square root, square, compare.

Annunaki 2003-07-21 18:52

TravisT wisual proof of your statement would be really nice..:)

wblipp 2003-07-22 06:23

[quote="dsouza123"]If your initial number = i and final number = f
i and f are boundary values of a series of consecutive odd numbers then

sum = ( i + f ) / 2 * ( f - i + 2 ) / 2

i = 25
f = 29
sum = (25+29)/2 * (29-25+2)/2
sum = 27 * 3
sum = 81[/quote]

Here's a trick using Pythagorean triples to figure out the cases that are square.

[b]EDIT - improved the method[/b] by using the fact the i and f are odd.


Let a = ( f + 1)/2 and b = ( i - 1)/2


a and b are integers because f and i are odd.

Then sum = (a+b)*(a-b) = (a^2 - b^2)

We want the sum to be a perfect square, so we are looking for values that make

a^2 - b^2 = c^2

b^2 + c^2 = a^2

So (b,c,a) is a Pythagorean Triple.

It's known that Primitive Pythagorean Triples are of the form

(p^2-q^2), (2pq), (p^2 + q^2)

There isn't any reason for our Pythagorean triple to be primitive, though. So the values may be "d" times this. There are two ways to match up the smaller terms. = b might be equal to the even primitive or the odd primitive. Let's first consider the even case first.

b=2dpq
c=d(p^2-q^2)
a=d(p^2+q^2)

In the example, we know the initial value "i" is equal to 25. We also know that
i = 2b+1 = 4dpq+1
25 = 4dpq+1
6=dpq.

Keeping p>=q so that p^2-q^2 is non-negative, the possible values are
[code:1]
d p q
1 6 1
1 3 2
2 3 1
3 2 1[/code:1]

We know the final value is f=2a-1=2d(p^2+q^2)-1. Calculating this for each case, we get final values of 73, 25, 39, 29, and 23. I don't know what to make of the 23, but the other final values result in sums that are perfect squares: 35^2, 5^2, 16^2, and 9^2.

Trying the other matchup, with b=d(p+q)(p-q) did not generate any new final values.

Assuming your interest is always sums of consecutive odd numbers, this appears to be a straight forward [b]way to determine, for a given initial value, all final values where the sum is a perfect square.[/b] The method could probably be adapted for sums of other arithemetic series.

Orgasmic Troll 2003-07-22 14:10

Before I try to figure out how to get a visual proof of this up, I would like to make sure that it's really what you want.

What I proved is only useful if the sequence is every other number (an arithmetic sequence with constant 2) which is what you gave in the example, but I don't know if you need a general case as well

Also, if you need the smallest sum that equals a square for each sequence, what I figured out won't help you.

If it's still useful, I'll go ahead and get the visuals ready

Annunaki 2003-07-22 18:56

may be you have still misunderstood my problem a little bit..
the question is about number of cycles or computations needed to know when will i get the perfect square..
In the perfect case I would need to now only 0th element and 1th element to tell how many elements will i need to reach a perfect square..
for example
i know that 0th element is 14 and first element is 51(diferential is allways 2 so every next element will be constantly increased by two - 53, 55, 57, 59 etc..)
so the question is can i tell how many element will i need to tell when the summ of the all string will be some natural n^2.. only knowing that 14 is the 0th element and 51 is the first element..(diferential is 2 as a rule)..
of course in this case it is easy just to summ up element asnd calculate:
14+51=65; 65+53=118; 118+55=173; 173+57=230; 230+59=289=17^2 which is answer in this case..
But with large numbers it can need VERY MUCH cycles and lots of computations so i am looking for an ultimate method... Of course i am ready to receice any suggestions that would make such computations easier.. and thank you for your answers in any case

Maybeso 2003-07-22 18:59

One fairly quick method of finding square sums is to use [b]TravisT[/b]'s formula for the sum of a sequence of k odd terms starting at n: :idea: S = k^2 + k(n - 1).

:question: If n is a square, is {k = 1, S = n} a valid solution?

First, try k = (n - 1)/3. if k is an integer, then S is a square. For large n, this probably won't be the first square sum.

To find the first square S, keep a list of squares and 2*squares. i.e.:
4, 9, 16, 25, 36, 49, 64, 81, 100, ...
2, 8, 18, 32, 50, 72, 98, 128, 162, 200, ...

If k is a square, and (k+n-1) is a square, then S is also a square.
If k is 2*square, and (k+n-1) is 2*square, then S is also a square.

The only solution I found which didn't fit these patterns was:
n = 31, k = 24, k^2 + k(n-1) = 576 + 24*30 = 36^2
576 + 24*30 = 9(64 + 80) = 16(36 + 45) = 144(4 + 5)

Fortunately, this was not the first square sum for n = 31. But we need a pattern that would tell us to check k = 24 in this case. The only things I see are:
1. k is a square times a factor of (n - 1) -> n - 1 = 5*6, k = 2*2*6.
2. k = 6*2^2 and (k + n - 1) = 6*3^2.

Looking for the first pattern would introduce too many k values to try. And the second pattern means trying even more. :(

For very large n, [b]wblipp[/b]'s solution is probably faster if you can code it to catch all combinations.

Annunaki 2003-07-22 19:24

yes.. those solutions may be faster that just summing up and checking.. but i think i will need a method to that finds how much elements will i need to get a perfect square.. If I want to check after every elemetn if the sum now is perfect square i doubt i will live long enough to wait while my test will finsh on REALLY large numbers...:)

wblipp 2003-07-22 20:32

[quote="Annunaki"]but i think i will need a method to that finds how much elements will i need to get a perfect square[/quote]

I think that my previous post does exactly that, and it has worked through the example for starting with 25. If you are having trouble following it, I'll work through a second example. What would like to use as the initial value in this new example? Pick something large enough to be interesting.

Orgasmic Troll 2003-07-22 21:57

let me see if I can translate the visual proof .. it's based on the fact that square numbers are the sums of odd numbers

so if you look at say, 11, you know that 1 + 3 + 5 + 7 + 9 + 11 is a square number (36)

now, if you remove terms 1 through 9 and start an arithmetic sequence with 11, the sum of that sequence will always be 25 short of a square number, so once you get to 25 in the sequence, you can use it to fill in the first numbers in your sequence.

so 11 + 13 + 15 + .. 23 + 25 = 1 + 3 + 5 + .. + 21 + 23 = 144

But if you started with 13, then 1 + 3 .. + 11 = 36, which is an even number, which will never show up in your sequence, so in that case, you need to find the 2 consecutive odd numbers that equal 36, to find them, you divide 36 by two, which is 18 and take the odd numbers on either side (17 + 19) so when your sequence reaches 19, it equals a square number

so for a number [i]n[/i], if it leaves a remainder of 3 when you divide by 4 (like the 11 example) the last term in the sequence is (n-1)^2/4

if it leaves a remainder of 1, like the 13 example, the last number in the sequence is (n-1)^2/8+1

Now, for an even number, say, 12, you have to think of 12 + 14 + 16 + .. s (11 + 1) + (13 + 1) + (15 + 1) + ...

in which case you have the same 11 + 13 + 15 + .. sequence we started with, plus an extra [i]k[/i] where [i]k[/i] is the number of terms, but you can think of every term as filling one more into the missing square left by 1 + 3 + 5 + 7 + 9 = 25, so it takes 25 terms to fill in that square.

so the last term of the sequence if [i]n[/i] is even is n + (n-2)^2/4 - 2


.. Well, I wouldn't be surprised if this isn't exactly transparent .. I don't think I'm capable of lucidly explaining where I got the general forms, so I just left it out

Maybeso 2003-07-22 22:31

[b]wblipp[/b],

[b]Annunaki[/b] has introduced a 0th element, that needs to be included in the perfect square sum. Is there a way to do that with your method?

If so, use { 9, 115 } -- 9 + 115 + 117 + ... = square.

If not, use { i = 113 }

If these are still too small use { 688, 4577 } and { i = 4321 }

I want to be sure I understand how you generate all your valid solutions.

wblipp 2003-07-23 00:55

[quote="Maybeso"][b]wblipp[/b],

[b]Annunaki[/b] has introduced a 0th element, that needs to be included in the perfect square sum. Is there a way to do that with your method?

If so, use { 9, 115 } -- 9 + 115 + 117 + ... = square.

If not, use { i = 113 }

If these are still too small use { 688, 4577 } and { i = 4321 }

I want to be sure I understand how you generate all your valid solutions.[/quote]

I don’t see a way to include the zero term, although I’ll think about it. To make up for that, I’ll exhibit the larger case of i =4321.

Define variables:
a=(f+1)/2 and b= (i-1)/2

Show relationship
SUM = a^2 – b^2 = c^2

Rearrange as Pythagorean Triple:
b^2 + c^2 = a^2

Parameterize solution, picking b as the even primitive:
Let b=2dpq, c=d(p^2-q^2), a=d(p^2+q^2)

Knowing i, find all values of d, p, q with p>q
i= 2b+1 =4dpq+1
4321 = 4dpq+1
4320 = 4dpq
1080 = dpq

The prime factorization of 1080 is 2x2x2x3x3x3x5. There are 152 ways to pick d, p, and q with p>=q and the product equal to 1080. I listed these in a spreadsheet, and then also calculated the value for f = 2a-1 = 2d(p^2+q^2)-1, and I also calculated “c”, the square root of the sum, as c=d(p^2-q^2). The first line of this table is derived from d=1, p=36, and q=30. It tells us that if we sum from 4321 tp 4391, the total will be 396^2.
[code:1]
d p q f c
1 36 30 4391 396
1 40 27 4657 871
1 45 24 5201 1449
1 54 20 6631 2516
1 60 18 7847 3276
1 72 15 10817 4959
1 90 12 16487 7956
1 108 10 23527 11564
1 120 9 28961 14319
1 135 8 36577 18161
1 180 6 64871 32364
1 216 5 93361 46631
1 270 4 145831 72884
1 360 3 259217 129591
1 540 2 583207 291596
1 1080 1 2332801 1166399
2 27 20 4515 658
2 30 18 4895 1152
2 36 15 6083 2142
2 45 12 8675 3762
2 54 10 12063 5632
2 60 9 14723 7038
2 90 6 32543 16128
2 108 5 46755 23278
2 135 4 72963 36418
2 180 3 129635 64782
2 270 2 291615 145792
2 540 1 1166403 583198
3 20 18 4343 228
3 24 15 4805 1053
3 30 12 6263 2268
3 36 10 8375 3588
3 40 9 10085 4557
3 45 8 12533 5883
3 60 6 21815 10692
3 72 5 31253 15477
3 90 4 48695 24252
3 120 3 86453 43173
3 180 2 194423 97188
3 360 1 777605 388797
4 18 15 4391 396
4 27 10 6631 2516
4 30 9 7847 3276
4 45 6 16487 7956
4 54 5 23527 11564
4 90 3 64871 32364
4 135 2 145831 72884
4 270 1 583207 291596
5 18 12 4679 900
5 24 9 6569 2475
5 27 8 7929 3325
5 36 6 13319 6300
5 54 4 29319 14500
5 72 3 51929 25875
5 108 2 116679 58300
5 216 1 466569 233275
6 15 12 4427 486
6 18 10 5087 1344
6 20 9 5771 1914
6 30 6 11231 5184
6 36 5 15851 7626
6 45 4 24491 12054
6 60 3 43307 21546
6 90 2 97247 48576
6 180 1 388811 194394
8 15 9 4895 1152
8 27 5 12063 5632
8 45 3 32543 16128
8 135 1 291615 145792
9 12 10 4391 396
9 15 8 5201 1449
9 20 6 7847 3276
9 24 5 10817 4959
9 30 4 16487 7956
9 40 3 28961 14319
9 60 2 64871 32364
9 120 1 259217 129591
10 12 9 4499 630
10 18 6 7199 2880
10 27 4 14899 7130
10 36 3 26099 12870
10 54 2 58399 29120
10 108 1 233299 116630
12 10 9 4343 228
12 15 6 6263 2268
12 18 5 8375 3588
12 30 3 21815 10692
12 45 2 48695 24252
12 90 1 194423 97188
15 9 8 4349 255
15 12 6 5399 1620
15 18 4 10199 4620
15 24 3 17549 8505
15 36 2 38999 19380
15 72 1 155549 77745
18 10 6 4895 1152
18 12 5 6083 2142
18 15 4 8675 3762
18 20 3 14723 7038
18 30 2 32543 16128
18 60 1 129635 64782
20 9 6 4679 900
20 18 3 13319 6300
20 27 2 29319 14500
20 54 1 116679 58300
24 9 5 5087 1344
24 15 3 11231 5184
24 45 1 97247 48576
27 8 5 4805 1053
27 10 4 6263 2268
27 20 2 21815 10692
27 40 1 86453 43173
30 6 6 4319 0
30 9 4 5819 1950
30 12 3 9179 4050
30 18 2 19679 9600
30 36 1 77819 38850
36 6 5 4391 396
36 10 3 7847 3276
36 15 2 16487 7956
36 30 1 64871 32364
40 9 3 7199 2880
40 27 1 58399 29120
45 6 4 4679 900
45 8 3 6569 2475
45 12 2 13319 6300
45 24 1 51929 25875
54 5 4 4427 486
54 10 2 11231 5184
54 20 1 43307 21546
60 6 3 5399 1620
60 9 2 10199 4620
60 18 1 38999 19380
72 5 3 4895 1152
72 15 1 32543 16128
90 4 3 4499 630
90 6 2 7199 2880
90 12 1 26099 12870
108 5 2 6263 2268
108 10 1 21815 10692
120 3 3 4319 0
120 9 1 19679 9600
135 4 2 5399 1620
135 8 1 17549 8505
180 3 2 4679 900
180 6 1 13319 6300
216 5 1 11231 5184
270 2 2 4319 0
270 4 1 9179 4050
360 3 1 7199 2880
540 2 1 5399 1620
1080 1 1 4319 0[/code:1]

Perhaps the most interesting linea in the table are that summing through 4319 results in a sum of zero. This makes sense in a perverse way – if you stop after 4319 you will stop before you start, and the sum will be zero.

Counting zero, there are 74 different squares that are possible.

Annunaki 2003-07-23 10:10

TravisT thank you.. your explanation was really good.. However there are still some porblems.. Knowing that there is still some problems.. Even 0th elemnt isn`t problem as we can use some trick for example..
if 0th element is 8 and first element is 133
we can just go some elements back and calculate from 133-8=125..
because sequence from 125 up will allways be smaller by 8 if we use the same amount of elements..
(if 0th element is odd number it isn`t so easy but i think i can find solution for that..)
However as i said there still is some problems..
With that method we can find weh nsequence will reach some perfect square but it is not said it will be the soonest perfect square in the sequence, but in some cases it could be very important to find the soonest..
for example let fist element be 19
then soonest square is made up form 6 elements because 24*6=144
19+21+23+25+27+29=144
but with your method last member of this chain should be 81.. Yes i could even agree to you because may be it is very last member of this chain as may be i can even proove that after 81 you will never be able to find any perfect squares..
Howevere thank you for showing me the last posible elements.. or terms how do you call them;)

Annunaki 2003-07-23 10:12

Wblipp, sorry, but i think i failed to follow your posted method.. I really think i can understand it, but unfortunately i have very little experiecne in reading math or programming language code.. So bettere please explain on what is based your test..

Orgasmic Troll 2003-07-23 13:48

Annunaki, I tried to explicitly say that what I figured out is definitely not going to give the smallest sequence, because I wasn't sure if that's what you needed, that's why I was hesitant to explain a proof. I haven't really looked through wblipp's algorithm, but the general consensus is that he's got something that will help you out

Annunaki 2003-07-23 14:10

anyway thanks a lot for your help.. you gave me 1 new idea and that is much..
...and excuse me for my mistake when i said that including 0th element will be so easy like substracting 0th element form 1ht element and calculating then as it was withouth oth element..

wblipp 2003-07-23 15:07

[quote="Annunaki"]Wblipp, sorry, but i think i failed to follow your posted method.. I really think i can understand it, but unfortunately i have very little experiecne in reading math or programming language code.. So bettere please explain on what is based your test..[/quote]

The first step is to transform the problem into a question about Pythagorean Triples. Pythagorean Triples are integers that can be the sides of a right triangle, so that x^2 + y^2 = z^2. (That equation is read as "x-squared plus y-squared = z-squared.)

We get this transformation by creating two new variables, "a" and "b" that are defined in terms of the old variables "i" (for intial value) and "f" (for final value).

The variables are defined by the simple rules:

a = (f+1)/2
b = (i-1)/2

These equations can be rearranged to give
f = 2a-1
i = 2b+1

dsouza123 has pointed out the sum (when there is not a zeroth term) is

sum = ( i + f ) / 2 * ( f - i + 2 ) / 2

If you substitute the i & f equations into this, you will get

sum = ((2b+1) + (2a-1))/2 * ((2a-1) - (2b+1) + 2)/2
sum = (2a + 2b) / 2 * (2a + 2b - 2 + 2)/2
sum = (a + b) * (a - b)

We can multiply these together to get

sum = a^2 - b^2

You want the sum to be a square, so we are looking for

sum = c^2.

Together, this is

c^2 = a^2 - b^2

We can add b^2 to both sides, getting

b^2 + c^2 = a^2

Which now has the problem transformed into a problem about Pythagorean triples. If we started with any Pythagorean Triple, we could work backwards to find an "i" and an "f" such that the sum would be a perfect square. For example, the most famous Pythagorean Triple is (3,4,5). If b=3 and c=4 and a = 5, then

i = 2b+1 = 7
f = 2a - 1 = 9

And the sum from 7 to 9 is c^2 = 4^2 = 16.

This particular Pythagorean triple would not suit our needs unless we were looking for a sum starting with 7. The next step is to figure out which Pythagorean Triples yield the desired initial value.

Can you follow it this far? If not, ask questions.

Annunaki 2003-07-23 16:07

ok.. I understand you want to usePythagorean theorem to solve this..
first question would be.. how do you figured that you need new wariables thus - a and b..
a=(f+1)/2 and b=(i-1)/2.. yes we ca eaasy calculate one of these waluaes(b) as we know nitial walue (i).. but from where comes our wish to act like this.. i I can`t understand how you chosed the values of a and b..

Annunaki 2003-07-23 17:48

thus if you didn`t understand my question.. I wish to know why or better how you choosed to define a and b.. Was you just looking what values for a and b you will need to get equation a^2+b^2=c^2.. or you defined
a as (f+1)/2 and b as (i-1)/2 knowing something that i do not know..
ok may be a stupid question.. but i still want to know if there was some specific reasons why you chhose a and b values as they are..

wblipp 2003-07-23 19:20

[quote="Annunaki"]ok.. I understand you want to usePythagorean theorem to solve this..
first question would be.. how do you figured that you need new wariables thus - a and b..
a=(f+1)/2 and b=(i-1)/2.[/quote]

The first thing to observe is that it doesn't really matter - now that somebody has figured it out and shown it to you, you can use it to answer your questions without knowing how it was found.

I observed that the expression was already close the form (f+i)*(f-i), so I went looking for a transformation that would make it exact. I originally hit on

a=(f+1) and b=(i-1)

I even went so far as to post using this approach. Later I noticed that because f and i are odd, the a and b are always even. Putting the "divide by two" into the expression resulted in a tigher, more elegant expression. That was the cause of a major edit in my first post.

As for "why?" - I've found that lots of interesting things can be done with expressions that have a small number of squares, so I tried to get the expression into this form to see if some of those tricks could be applied. As it turns out, the Pythagorean Triples Trick turned out to be very useful.


Any more questions?

Annunaki 2003-07-23 20:44

Ok i understood how you transformed our task to Pythagorian triangle..
but now it will be interesting to see how you will use this to solve problem..
do you suggest going through all posible Pythagorian triangles starting from 3;4;5 and continiuing with all next that are posible?
ok i am ready to read next part of your alghorithm...

wblipp 2003-07-24 02:31

[quote="Annunaki"]do you suggest going through all posible Pythagorian triangles starting from 3;4;5 and continiuing with all next that are posible?
ok i am ready to read next part of your alghorithm...[/quote]

Next we need to know a few facts about Pythagorean Triples. First, you can scale up any triple by multiplying all the numbers by a constant. For example, (3,4,5) can be scaled to (6,8,10) or (9,12,15) or (3033,4044,5055). In general, any Pythagorean Triple (x,y,z) can be scaled by "d" to become (d*x, d*y, d*z).

The next thing to know is that all primitve pythagorean triples - those that do not share a common factor - can be generated by picking two numbers "p" and "q" and creating the triple (2pq, p^2-q^2, p^2+q^2). It's easy to show this is always a Pythagorean Triple -

For example, pick p=2 and q=1, we get (4, 3, 5) - the most famous Pythagorean Triple.
Pick p=3, q=2 we get (12, 5, 13), another famous triple.
Pick p=17 q=4 we get (136,273,305) - a relatively obscure triple.

If we put these two facts together, we have that by picking any three numbers, "d", "p", and "q", we can generate a Pythagorean Triple

(2dpq, d*(p^2 - q^2), d*(p^2 + q^2))

So how do we find Pythagorean Triple that match our initial conditions.? Let's work though a simple example, with i=77. We know that b=(i-1)/2, so b = (77-1)/2 = 38. How can we find Pythagorean Triples with 38 as one of the "side legs"? One way to do this is to pick the "2dpq" leg. Then we need solutions to

2dpq=38
dpq=19

There are only 3 ways to pick 3 numbers that multiply together to make 19 -
19,1,1 and 1,19,1 and 1,1,19. We can ignore the last one because swapping p and q results in the same Pythagorean Triple. So we have two sets of values for d, p, q. This results in two Pythagorean Triples that match up with i=77:

(b,c,a) = ( 38, 0, 38 ) or ( 38, 360, 362 )

For each case we can calculate the final value from f=2a-1. This gives us final values of 75 or 723. We can also calculate the square root as c - the two square roots are 0 and 360.

The case of f=75 and c=0 is a funny solution that we have seen before. It means that if you stop before you start you get zero - that's usually an uninteresting solution. The only other solution is that adding from 77 to 723 results in 360 squared.

This example gave very few results before there were very few ways to pick d, p, and q. See the previous example for a case that had 152 different was to pick d, p, and q, resulting in 74 different squares.

There is one more issue that needs to be discussed, but let's see if you have any questions so far.

Annunaki 2003-07-24 08:21

hmm.. i will look at it a little bit later.. but for now it seems that it may be something good.. Hovewer we need to find a way to include 0th element..
and in general case i need only to find soonest square not all of them.. but of course this mehod still looks good for now..

wblipp 2003-07-24 14:46

[quote="Annunaki"]hmm.. i will look at it a little bit later.. but for now it seems that it may be something good.. Hovewer we need to find a way to include 0th element..
and in general case i need only to find soonest square not all of them.. but of course this mehod still looks good for now..[/quote]

I don't see a way to include an arbitrary zeroth element into this approach - is there perhaps some relationship between your zeroth element and your initial element we could exploit?

I haven't thought too much about the "soonest" issue, but because f = 2a-1 and a = d*(p^2+q^2), it should be easy to select the values of d, p, and q that give the smallest a and therefor the smallest f.

Annunaki 2003-07-24 18:23

i fear there are no more relationship between oth elment and first element.. the only thing I can say about 0th element that it will be allways at least by 3 lesser than fisrt element.. thus the 0th<1st-2
I think the only way to include 0th element is to find a squence that has exactly the same number of elements, but the sum is allways largen than that of the orginal sequenece by 0th element
for example if:
sequence is
8, 21, 23, 25 ,27
we can shiwtch it to 23,25,27,29..
but that is only in casw with 4 elements but i still think that it can be done..
only i still cant figure how..

Annunaki 2003-07-24 19:13

may be a proof to hte statement that every Pythagoreon triple can be formed from natural p and q if sides are - 2pq; p^2+q^2; p^2-q^2; could help us..
thus may be if we know on what is based this statement we can step a little bit higher..

Annunaki 2003-07-26 15:00

hmm i think i noticed something..
and i can include 0th element..
can you check easely when some triple will be Pythagoreon triple..
for example
if i know two sides of that triple.. and they grow in progression..
Can i know when natural Pythagoreon triple will be posible for example i know.. that
two sides of triple are
26; 25
28; 25
30; 25
etc.. can i tell when triple of Pythagorian will be possible.. According to what i can read it is posible even very posible.. but that is too easy.. that is why I can`t believe in that.. I will think about it again..

Annunaki 2003-07-26 15:19

hmh .. i think i found a bug in my previous post..
that is not so easy..
i dont need to find only when it will be Pythagoreon triple..
i Actually need to know if pythagoreon triple would be posible if I add 0th element:(
in that case it would be.. 0th=14
26^2-25^2 +14
28^2-25^2 +14
30^2-25^2 +14
etc. notice that 30^2-25^2+14 gives us answer as it is 289=17^2..
but can we tell it somehow more efectively..


All times are UTC. The time now is 15:15.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.