[seqfan] Re: How to generate A000047?

Harry J. Smith hjsmithh at sbcglobal.net
Tue Jan 20 00:15:53 CET 2009


Thanks to all that answered my question. I have a working PARI program now,
but it gets slow after this output:

0 1
1 2
2 3
3 5
4 8
5 15
6 26
7 48
8 87
9 161
10 299
11 563
12 1066
13 2030

My PARI program is:

{
  m=-1;
  b=0;
  p=1;
  for (n=1, 10000000000,
    if(n>0,
      c=0;
      a=0;
      while(c<n,
        a++;
        if(sum(i=0, sqrtint(a\2), issquare(a+2*i^2)), c++);
      );
      b++;
      if (a==p, m++; print(m," ",b); write("b000047.txt",m," ",b); p=p*2;)
    )
  )
}


-Harry


> -----Original Message-----
> From: seqfan-bounces at list.seqfan.eu [mailto:seqfan-bounces at list.seqfan.eu]
On
> Behalf Of T. D. Noe
> Sent: Monday, January 19, 2009 10:44 AM
> To: Sequence Fanatics Discussion list; seqfan at seqfan.eu
> Subject: [seqfan] Re: How to generate A000047?
> 
> See A035251. It says "n is representable in the form x^2-2y^2 iff every
> prime p == 3 or 5 mod 8 dividing n occurs to an even power."
> 
> Much faster than Mma.
> 
> Tony
> 
> 
> _______________________________________________
> 
> Seqfan Mailing list - http://list.seqfan.eu/





More information about the SeqFan mailing list