{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

PARI9-5-07

# PARI9-5-07 - 18.781 In-Class Discussion September 5 2007...

This preview shows pages 1–3. Sign up to view the full content.

18.781 In-Class Discussion, September 5, 2007 parisize = 4000000, primelimit = 500000 (13:42) gp > P(n)=c=1;for(k=2,n/2,if(isprime(2*k-1), c++));c (13:44) gp > P(5) %1 = 2 (13:44) gp > P(50) %2 = 15 (13:44) gp > P(500) %3 = 95 (13:45) gp > P(5000) %4 = 669 (13:45) gp > P(5*10^4) %5 = 5133 (13:45) gp > P(5*10^5) %6 = 41538 (13:45) gp > P(5*10^6) %7 = 348513 (13:47) gp > ## *** last result computed in 1mn, 41,340 ms. (13:47) gp > P(5*10^7) %8 = 3001134 (14:06) gp > ## *** last result computed in 18mn, 4,480 ms. In the calculation above, note that PARI knows a table of primes up to 500,000 (“primelimit”) so calculations with such primes are ultrafast. But for larger n , we are forced to define our own function, like P ( n ).

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
We can slightly modify the program, defining a function L ( n ) to count the number of primes of the form 5 k + 2 which are less than n . GP/PARI CALCULATOR Version 2.1.6 (released) i686 running linux (ix86 kernel) 32-bit version (readline v4.3 enabled, extended help available) Copyright (C) 2002 The PARI Group PARI/GP is free software, covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY WHATSOEVER. Type ? for help, \q to quit. Type ?12 for how to get moral (and possibly technical) support.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}