mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Math (https://www.mersenneforum.org/forumdisplay.php?f=8)
-   -   Largest 64 bit prime? (https://www.mersenneforum.org/showthread.php?t=3471)

 amcfarlane 2004-12-26 19:33

Largest 64 bit prime?

Can anyone tell me please what the largest prime number is that will fit into a 64-bit unsigned variable?

 Xyzzy 2004-12-26 21:06

Sounds like a homework problem!

[url]http://www.utm.edu/research/primes/lists/2small/0bit.html[/url]

:innocent:

 Xyzzy 2004-12-26 21:12

[code]mv@k8:~\$ echo '2^64-59' | bc | factor
18446744073709551557: 18446744073709551557[/code]:smile:

 Xyzzy 2004-12-26 21:20

Had I not cheated with that link, I would have done this:

[code]#!/bin/sh
counter=1
while [ \$counter != 1 ]
do
echo '2^64-'\$counter | bc | factor
(( counter += 1 ))
done[/code]

 amcfarlane 2004-12-26 21:26

That's very clever ! -- Thanks...

 marc 2004-12-26 22:37

Might want to set your while loop to != 0 or even just something like while [ " " ] and there's the obvious += 2 time saver.

 alpertron 2004-12-26 23:15

Just write b(2^64) in [URL=http://www.alpertron.com.ar/ECM.HTM]my factoring applet[/URL].

 All times are UTC. The time now is 00:13.