English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I just rediscovered a java program I wrote a long time ago that will quickly show you prime numbers within a selected range of numbers. For example, find all prime numbers between

800000000000001

and

800000000001001

and I discover all of these are prime:

800000000000017
800000000000039
800000000000053
800000000000057
800000000000137
800000000000167
800000000000183
800000000000221
800000000000263
800000000000321
800000000000363
800000000000371
800000000000381
800000000000407
800000000000413
800000000000417
800000000000437
800000000000491
800000000000533
800000000000611
800000000000627
800000000000653
800000000000657
800000000000687
800000000000699
800000000000779
800000000000807
800000000000911
800000000000951

And just for fun, my program took a while to compute this, but this is also prime...

3,011,992,887,555,100,289 (that's three quintillion, hahaha)

What an age we live in!

2007-07-20 16:22:39 · 6 answers · asked by what? 5 in Science & Mathematics Mathematics

"Wow, how long did it take to compute
3 011 922 887 555 100 289 ??
An hour or a week?"

My laptop took about 5 or 10 minutes to find that in a range of about 100 numbers.

2007-07-20 16:36:50 · update #1

6 answers

I recommend you try coding up the Miller-Rabin primality test. It's extremely fast. For example, even a computationally slow language like Python was able to test all the numbers from (10^40) to (10^40 + 1000) for primality. Here are the primes in that range:

10 000 000 000 000 000 000 000 000 000 000 000 000 121
10 000 000 000 000 000 000 000 000 000 000 000 000 139
10 000 000 000 000 000 000 000 000 000 000 000 000 301
10 000 000 000 000 000 000 000 000 000 000 000 000 391
10 000 000 000 000 000 000 000 000 000 000 000 000 457
10 000 000 000 000 000 000 000 000 000 000 000 000 513
10 000 000 000 000 000 000 000 000 000 000 000 000 627
10 000 000 000 000 000 000 000 000 000 000 000 000 753
10 000 000 000 000 000 000 000 000 000 000 000 000 837
10 000 000 000 000 000 000 000 000 000 000 000 000 883
10 000 000 000 000 000 000 000 000 000 000 000 000 921
10 000 000 000 000 000 000 000 000 000 000 000 000 979
10 000 000 000 000 000 000 000 000 000 000 000 000 991

Calculating the entire list took less than 5 seconds on my modest 2.0 GHz processor.

For a further example of the ability of the Miller-Rabin test, I had Python start at 3^500 (which has 239 digits), then count upward, testing each number for primality, then to report the first prime it found. Here is the prime, which took about 20 seconds to find:

36360291795869936842385267
07954331911802338502600162
30403460358325806001915838
95484198508262979388783308
17970253440385575285593151
70130661429924309165620257
80021771247847643450125342
83656581320997259037159015
25787280083859901397953776
10197

That's all one number.

You can learn about the Miller-Rabin algorithm here:
http://en.wikipedia.org/wiki/Miller-Rabin_primality_test

And yes, 511000984431229 is a prime number.

2007-07-20 16:39:27 · answer #1 · answered by lithiumdeuteride 7 · 2 0

Wow, how long did it take to compute
3 011 922 887 555 100 289 ??
An hour or a week?

2007-07-20 23:27:43 · answer #2 · answered by winter_new_hampshire 4 · 0 0

Wow thanks for enlightening me with the knowledge that such big prime numbers exist. I might as well right my own program and check it out myself. I dont know how to handle such big numbers as input though.
:-(

2007-07-20 23:31:19 · answer #3 · answered by mermaid 4 · 0 0

I thought you're asking us a question. I would rather salute you if what you know could help the starving people of the world and at the same time enrich yourself.

2007-07-21 00:10:11 · answer #4 · answered by Jun Agruda 7 · 2 1

quintillion,isn't a real number...is it?

2007-07-20 23:25:28 · answer #5 · answered by cuteygirlash 2 · 0 1

And what is the use of giving us that little bit of information???

2007-07-20 23:26:30 · answer #6 · answered by the man 2 · 0 3

fedest.com, questions and answers