![]() |
Largest 64 bit prime?
Can anyone tell me please what the largest prime number is that will fit into a 64-bit unsigned variable?
|
Sounds like a homework problem!
[url]http://www.utm.edu/research/primes/lists/2small/0bit.html[/url] :innocent: |
[code]mv@k8:~$ echo '2^64-59' | bc | factor
18446744073709551557: 18446744073709551557[/code]:smile: |
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] |
That's very clever ! -- Thanks...
|
Might want to set your while loop to != 0 or even just something like while [ " " ] and there's the obvious += 2 time saver.
|
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 13:32. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.