It’s just data

Prime Ones

Tim Bray: I'm wondering if there is any number except for 11 whose digits are all '1' that is prime?

1111111111111111111 looks promising.


11111111111111111111111

Posted by anonymous at

An additional observation: for a number consisting entirely of ones to be prime, the number of digits itself must be prime. Otherwise, if the number of digits has a factor 'f', then a number consisting simply of 'f' ones will be a factor of the original number.

To illustrate why, consider a number with 25 ones. It is divisible by both 100001000010000100001 and 11111.

Posted by Sam Ruby at

Interesting... so a number consisting of 1111111111111111111 number 1's should, in theory, be a prime number given that 1111111111111111111 is prime?

Does that mean 1111111111111111110 is considered Choice and 1111111111111111109 Grade?  While
1111111111111111101 is the stuff hotdogs are made out of?  (sorry, long day)



Posted by James Snell at

James: s/should/may/

Eleven is prime.  Yet a number made with eleven ones is divisible by 21,649.

All that can be reliably said is that a number made with a composite number of ones is not prime.



Posted by Sam Ruby at

So I was thinking how much that way-cool "number of digits must be prime" generalizes to bases other than 10, for example binary, and recalled that over among the real mathies there's this huge literature on Mersenne primes, which are of the form 2**x-1, which in binary are of course always all ones.

Posted by Tim Bray at

Good thinking. So in other words, x must be prime in order for 2**x-1 to be prime. I'm sure they've thought of that optimization, but I think I'll look around the web just in case.

Posted by John Bethencourt at

i have started a program to check this
19 ones is prime
23 just checking

Posted by lemmi at

The numbers of the form 2^n-1 are called Mersenne numbers.

It easy to see that 2^(km) -1 = (2^k-1) (1+ 2^(k) + 2^(2k) + ... + 2^( (m-1)k))  so it can only be prime if km is prime.

Posted by hlg at

links for 2006-12-15

ongoing · 11,111km on the Odometer 1111111111111111111 is prime! (tags: math repunits prime numbers) Prime numbers, Ruby-style finding primes in one line, ruby style (tags: prime numbers ruby) Sam Ruby: Prime Ones I’m wondering if there is...

Excerpt from Oddly Zen at

A=1111...
n is digit number of A.
if n in {2,19,23,317,1031,?,...} then A is a prime number.

Posted by Semih Yılmaz at

Add your comment