Folks,
I am trying to generate Mill's Primes and the code is very simple.
For K = 1 and 2, the program gives the correct answers of 2 and 11.
But, for K = 3 it gives 1359 with the M value specified.
According to the maths (and Excel), the correct answer should be 1361 - the 3rd Mill's Prime.
I fail to understand where my calculation is going wrong.
Can someone please help.
Regards
pa99
10 CLS
20 REM Generate Mill’s Primes
30 REM Mill’s Constant = 1.3063778838630806904686144926...
40 DIM P AS DOUBLE
45 DIM M AS DOUBLE
50 INPUT “Number of Primes” ; K
60 M = 1.306337788
80 FOR N = 1 TO K
90 E = 3^N
100 P = M^E
120 PRINT FIX(P), M
130 NEXT N
999 END
I am trying to generate Mill's Primes and the code is very simple.
For K = 1 and 2, the program gives the correct answers of 2 and 11.
But, for K = 3 it gives 1359 with the M value specified.
According to the maths (and Excel), the correct answer should be 1361 - the 3rd Mill's Prime.
I fail to understand where my calculation is going wrong.
Can someone please help.
Regards
pa99
10 CLS
20 REM Generate Mill’s Primes
30 REM Mill’s Constant = 1.3063778838630806904686144926...
40 DIM P AS DOUBLE
45 DIM M AS DOUBLE
50 INPUT “Number of Primes” ; K
60 M = 1.306337788
80 FOR N = 1 TO K
90 E = 3^N
100 P = M^E
120 PRINT FIX(P), M
130 NEXT N
999 END