Free Republic
Browse · Search
General/Chat
Topics · Post Article

To: scrabblehack
By the time you get to 2^20 it is very hard.

Not really.

On my Mac, using a simple-minded Python program (an interpreted language), it takes around a second to count the primes up to 2**20:

$ time factor count-primes $((2**20))
     Limit    Count Density
   1048576    82025   7.82%

real	0m0.986s
user	0m0.921s
sys	0m0.036s
$

Here are the last ten of them:

time factor show-primes $((2**20)) 10
[1048391, 1048423, 1048433, 1048447, 1048507, 1048517, 1048549, 1048559, 1048571, 1048573]

real	0m0.755s
user	0m0.694s
sys	0m0.040s
$

Moving up to 2**24, things do slow down:

$ time factor count-primes $((2**24))
     Limit    Count Density
  16777216  1077871   6.42%

real	0m15.389s
user	0m14.747s
sys	0m0.244s
$

70 posted on 01/18/2018 6:41:02 PM PST by cynwoody
[ Post Reply | Private Reply | To 67 | View Replies ]


To: cynwoody

Am I sort of right about Bitcoin being tied to prime numbers?


74 posted on 01/18/2018 11:37:37 PM PST by scrabblehack
[ Post Reply | Private Reply | To 70 | View Replies ]

Free Republic
Browse · Search
General/Chat
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson