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

Re: pari/gp help

Expand Messages
  • Ken Davis
    And finally, you can include a forprime loop with with output to a file. The following does all primes
    Message 1 of 6 , Jan 15, 2008
      And finally,
      you can include a forprime loop with with output to a file.
      The following does all primes < 1000 (limit on ii and jj =1000)
      cheers
      Ken

      \\ 'algorithm for finding solutions to the equation -x^4+4*p*y^4= z^2'
      {
      forprime(pp=2,997,
      print(pp);
      forstep(ii=1,1000,1,
      forstep(jj=1,1000,1,
      poly=(4*pp*jj^4)-ii^4;
      if (poly<0,next(n=1));
      zz=sqrtint(poly);
      zz2=zz^2;
      if (zz2-poly,,
      write("poly.txt","result for p= ",pp," x= ",ii," y= ",jj,"
      z= ",zz);
      print("result for p= ",pp," x= ",ii," y= ",jj," z= ",zz);
      next(n=3));
      )
      )
      );
      }

      After running file poly.txt contained


      result for p= 5 x= 2 y= 1 z= 2
      result for p= 13 x= 2 y= 1 z= 6
      result for p= 29 x= 2 y= 1 z= 10
      result for p= 37 x= 6 y= 5 z= 302
      result for p= 53 x= 2 y= 1 z= 14
      result for p= 61 x= 18 y= 5 z= 218
      result for p= 73 x= 4 y= 1 z= 6
      result for p= 89 x= 4 y= 1 z= 10
      result for p= 101 x= 50 y= 29 z= 16718
      result for p= 109 x= 2 y= 5 z= 522
      result for p= 113 x= 4 y= 1 z= 14
      result for p= 149 x= 14 y= 5 z= 578
      result for p= 157 x= 186 y= 85 z= 177722
      result for p= 173 x= 2 y= 1 z= 26
      result for p= 229 x= 2 y= 1 z= 30
      result for p= 233 x= 4 y= 1 z= 26
      result for p= 269 x= 22 y= 5 z= 662
      result for p= 281 x= 4 y= 5 z= 838
      result for p= 293 x= 2 y= 1 z= 34
      result for p= 337 x= 32 y= 65 z= 155118
      result for p= 349 x= 6 y= 1 z= 10
      result for p= 353 x= 4 y= 1 z= 34
      result for p= 373 x= 6 y= 1 z= 14
      result for p= 389 x= 26 y= 5 z= 718
      result for p= 509 x= 374 y= 61 z= 92870
      result for p= 541 x= 190 y= 29 z= 15078
      result for p= 557 x= 118 y= 185 z= 1615418
      result for p= 593 x= 4 y= 1 z= 46
      result for p= 601 x= 24 y= 5 z= 1082
      result for p= 613 x= 6 y= 1 z= 34
      result for p= 617 x= 64 y= 25 z= 30778
      result for p= 653 x= 46 y= 13 z= 8374
      result for p= 661 x= 438 y= 85 z= 318142
      result for p= 677 x= 502 y= 85 z= 279022
      result for p= 709 x= 94 y= 13 z= 1710
      result for p= 733 x= 2 y= 1 z= 54
      result for p= 773 x= 34 y= 13 z= 9326
      result for p= 829 x= 34 y= 5 z= 858
      result for p= 853 x= 6 y= 1 z= 46
      result for p= 881 x= 8 y= 25 z= 37102
      result for p= 937 x= 24 y= 5 z= 1418


      --- In primenumbers@yahoogroups.com, "payoy18" <payoy18@...> wrote:
      >
      > oh i meant that i want to write the ubasic program below in pari/gp
      > since i believe it candle bigger numbers...:)
      >
      >
      > --- In primenumbers@yahoogroups.com, Norman Luhn <nluhn@> wrote:
      > >
      > > Hello, try this:
      > >
      > > 10 'algorithm for finding solutions to the
      > > equation -x^4+4*p*y^4= z^2'
      > > 20 input "Input p";Cc
      > > 30 for I=1 to 50000
      > > 40 for J=1 to 50000
      > > 50 if ((4*Cc*J^4)-I^4)<0 then goto 80
      > > 60 X=(4*Cc*J^4)-I^4
      > > 70 if X-isqrt(X)^2=0 then print I,J,X:cancel
      > > for,for:
      > > 80 next J
      > > 90 next I
      > > 100 end
      > > OK
      > >
      > > for p=113:
      > > Input p? 113
      > > 4 1 196
      > >
      > >
      > > Gruß
      > >
      > > --- payoy18 <payoy18@> schrieb:
      > >
      > > > i hope it isn't too much to ask help again...can you
      > > > please help me
      > > > convert this ubasic code to a pari/gp program...
      > > >
      > > >
      > > > i always get errors:(
      > > >
      > > >
      > > >
      > > > 10 'algorithm for finding solutions to the equation
      > > > -x^4+4*p*y^4=z^2'
      > > > 20 input "Input p";Cc
      > > > 30 for I=1 to 50000
      > > > 40 for J=1 to 50000
      > > > 50 if ((4*Cc*J^4)-I^4)<0 then goto 80
      > > > 60 Z=isqrt((4*Cc*J^4)-I^4)
      > > > 70 if res=0 then print I,J,Z: cancel for,for:
      > > > 80 next J
      > > > 90 next I
      > > > 100 end
      > > >
      > > >
      > > >
      > > >
      > > >
      > > >
      > >
      > >
      > >
      > > __________________________________ Ihre erste Baustelle?
      > Wissenswertes für Bastler und Hobby Handwerker. www.yahoo.de/clever
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.