How many primes among the positive integers, written as usual in base 10, are alternating 1’s and 0’s, begin- ning and ending with 1?

az_lender2018-02-22T06:43:06Z

llaffter's answer is wrong, as I have quickly found a second prime (5461). However, I can't give a complete answer.

101 = 5 is prime.
10101 = 21 is divisible by 3 and 7.
1010101 = 85 is divisible by 5 and 17.
It is easy to see that whenever the number of "1"s is even, the binary number that consists of alternating 1's and 0's will be divisible by 5.
And it is easy to see that whenever the number of "1" is divisible by 3, the binary number that consists of alternating 1's and 0's will be divisible by 21, and hence by 3 and 7.

So that leaves us to test strings where the number of 1's is
5, 7, 11, 13, ... 6(k-1), 6(k+1), ...

101010101 = 85 + 256 = 341 = 11*31.
Hence we can now eliminate any strings whose number of 1's is divisible by 5.

1010101010101 = 341 + 1024 + 4096 = 5461, which is a prime.
But we can eliminate any further strings whose number of 1's is divisible by 7.

101010101010101010101 = 5461 + 2^14 + 2^16 + 2^18 + 2^20
= 1398101, which is divisible by 23 and 89 and some larger prime.
Hence we can eliminate any further strings whose number of 1's is divisible by 11.

1010101010101010101010101 = 1398101 + 2^22 + 2^24
= 22369621, which is 2731 x 8191.
Again we can eliminate any further strings whose number of 1's is divisible by 13.

OK, I'm bored now. But it was fun finding out that the first responder's attempt contained an error...

?2018-02-22T06:34:01Z

Only one.

Your numbers are a geometric progression with r = 10² = 100. Viewed that way, 1 + 100 + 100 00 ... + 100ⁿ equals

(100^*(n+1)-1)/99. Assume this can be a prime P. And for convenience N = n+1. Rewriting gives

100^N = 99P + 1 for some N. Note that the LHS always terminates by a 00. For this to be true, P must be of the form 100u + 1 for some integer u. That is,

100^N = 99(100u+1) + 1. Simplifying gives 100^(N-2) = 99u + 1. Let N-2 = M. So you have

100^M = 99u + 1.

You now have fallen on a redundancy (an identical eqs, for some M and u). Thus if there is a solution to your question, there is thus only an initial one if there is one. And since M=1 & u = 1 works, this generates your unique solution:

M=1 & u = 1 --> P = 100u + 1 = 101. Thats your prime.

[ There is a little thing that needs to be verified formally in the given reasoning (I'm being lazy), but this is as close as it gets for now. So my conclusion of "only one" may still be wrong, maybe. ].

llaffer2018-02-22T05:40:09Z

Only 1.

101 is prime

(at least testing up to 19 digits)