OT-Governor General binary
D. Hugh Redelmeier
hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org
Wed Oct 6 06:27:02 UTC 2010
| From: D. Hugh Redelmeier <hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org>
| I wrote two variants of a program to count 33-bit binary palindromic
| primes. They both count 5572. They both might be buggy.
I should have mentioned that this code only works on C implementations
where unsigned long can hold 33-bit numbers (eg. AMD64, but not i386).
I could have used unsigned long long as the type but then
mpz_init_set_ui would have been unhappy.
There is a simple work-around. Since 32-bit numbers are representable
in unsigned long, and the 33rd bit is always one in a call to
mpz_init_set_ui, it is pretty simple to code around the limitation of
32 bit unsigned long.
So I saved a little bit of code at the expense of portability. Bad
me.
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list