Error in Exponentiation
Error in Exponentiation
(OP)
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
RE: Error in Exponentiation
CODE
RE: Error in Exponentiation
Great help.
RE: Error in Exponentiation
I learned something new from you again
As a former mathematician, I've never heard of Mill's prime numbers or those constants - almost unbelievable. I only read about it yesterday on Wikipedia: https://en.wikipedia.org/wiki/Mills%27_constant
I studied math and taught in a college for about 6 years. But I was mostly into numerical mathematics, differential equations, optimization, and statistics. Number theory has never been an area of interest to me.
RE: Error in Exponentiation
A kindred spirit.
Studied maths at uni but never enjoyed it.
Too many exams and too much pressure.
Now I enjoy it thoroughly (along with Physics).
My main interests are in Prime Numbers and Cantor's Infinite Set theory.
I also enjoy Linear Programming and use Excel's Solver to keep in touch.
Regards
pya