Loading ...
Sorry, an error occurred while loading the content.

primes n^2-2*k^2

Expand Messages
  • Robin Garcia
    A Pari program to find all primes 1 or 7 mod 8. For any k=1,2,3,4,5,....Choose the k value and the range u and m you want. Slow algorithm, though. Hope Phil
    Message 1 of 1 , Nov 6, 2006
    • 0 Attachment
      A Pari program to find all primes 1 or 7 mod 8.

      For any k=1,2,3,4,5,....Choose the k value and the range u and m you want.
      Slow algorithm, though.
      Hope Phil and David like it.

      {k=15;l=k+1;u=ceil(sqrt(2)*k);if(u%2==0,u=u+1);m=10000;v=u+m;forstep(a=u,v,2,if(gcd(a,k)!=1,next);t=a^2-2*k^2;c=ceil(sqrt(t/2));if(k%2==0,if(c%2==0,c=c+1),if(c%2!=0,c=c+1));d=ceil(sqrt(t));if(d%2==0,d=d+1);if(a<2*k,i=-4*k+3*a-2,i=a-2);forstep(b=d,i,2,if(issquare((b^2-t)\2),next(2)));if(-3*k+2*a<0,j=-7*k+5*a-1,j=a-l);forstep(n=c,j,2,s=2*n^2-t;if(issquare(s),next(2)));print([a,t,isprime(t)]))}


      ---------------------------------

      LLama Gratis a cualquier PC del Mundo.
      Llamadas a fijos y móviles desde 1 céntimo por minuto.
      http://es.voice.yahoo.com

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.