question on sequence format and PARI/GK questions

Alexander Povolotsky apovolot at gmail.com
Sun Nov 25 17:46:05 CET 2007


Hi,

I am thinking of creating the sequence

seq(n) = d1,c1,a1,b1,d2,c2,a2,b2, ...,dn,cn,an,bn,...,

Is such format  (equivalent to rectangular matrix with four columns ?)
 of a sequence acceptable:?

where

d = sqrt(1/2(c^2-(a^2+b^2)))

and "d" is even

sorted in the order of increasing "d".

And why do you limit solutions only to those with even d?(again, one
might ask ;-) ) - because I thought that may be the trend for even
"d"s could be different  from odd ones.
For example I noticed that (some?) solutions for
d = (2*n)^2
could be obtained if
c^2 = (2*n + 2*k + 1)^2
where k=2,3,4,...

I have already modified (in a quite ugly way - I should admit - I am
new at PARI/GK ) the A125084 PARI code (suggested by Artur)

isSumOfTwoSquares(n)={ local(cnt, a, b);cnt=0;a=0;while(a^2<=n,b=0;
while(b<=a && a^2+b^2<=n,if((a!=0)&&(b!=0)&&(n-a^2-b^2)==0,print1("a=",a,", ")
;print1("b=",b, "; ");cnt++;);b++ ;); a++ ;);return(cnt) ; }

{for(n=1,999, for(k=2,999,
if(isSumOfTwoSquares((2*n+2*k-1)^2-2*(2*n)^2)==0,print1("d=",(2*n),",");print1("c=",(2*n+2*k-1),",");,)))}

Such modified code is still not behaving the way I would want it -
I wanted to use return (0 vs >0) value from if(isSumOfTwoSquares(n)
function to either print or do not print c and d values ...
but the "for" code still prints c and values even when no a and b are
found during the if(isSumOfTwoSquares(n) call.

Also I would prefer the program to arrange the data so the first
column be "d", second be "c", then "a" and finally the  "b" column
....
(because "d", "c" are coming out sorted in ascending order) ...
Also I do not know how to arrange "new lines" to format the output ... .

I would appreciate answers/help.

Regards,
Alex



apovolot at gmail.com said:
I am thinking of creating the sequence


Is such format  (equivalent to rectangular matrix with four columns ?)


Well, that's not really a sequence, as commonly understood.
That's 4 sequences, interleaved.  It would be better to
from the dispenser) and give links between them.







More information about the SeqFan mailing list