×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# 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.

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

If you use more precise constant

#### CODE

60 M = 1.3063778838630806904686144926
you will get for K = 3 the result P = 1361

(OP)
Thanx

Great help.

### RE: Error in Exponentiation

Hi pya,

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

(OP)
Hi mikrom,

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

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!