How is 2015 like the Eye of Sauron?

Happy new year!

2015 = 11111011111 in binary. That is, 2015 is a binary palindrome containing just a single "0" bit -- and thus happens to look a lot like the Eye of Sauron! What's the next number that has this property?


The answer is 8127.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

4 solutions

Ossama Ismail
Jan 1, 2015

The next number will be 111111011111 1 2 = 1 F B F 16 = 1 × 1 6 3 + 15 × 1 6 2 + 11 × 1 6 1 + 15 = 8127 1111110111111_2 = 1FBF_{16} = 1\times 16^3 + 15 \times 16^2 + 11 \times 16^1 + 15 = 8127

Dan Wilhelm
Jul 12, 2015

Define the n n th palindrome as a ( 2 n + 1 ) (2n + 1) -bit binary number containing all ones except the middle bit. Let the decimal representation of the n n th palindrome be given by P ( n ) P(n) ; for example, P ( 5 ) = 2015 P(5) = 2015 , as given.

The largest number an n n -bit string can represent is ( 2 n 1 ) (2^n - 1) . Hence, a ( 2 n + 1 ) (2n + 1) -bit string of ones represents ( 2 2 n + 1 1 ) (2^{2n+1} - 1) . Switching the middle one-bit to a zero results in subtracting 2 n 2^n , since digits 0 0 to n 1 n-1 are half of the n n ones. Hence,

P ( n ) = ( 2 2 n + 1 1 ) 2 n = 2 n ( 2 n + 1 1 ) 1 P(n) = (2^{2n + 1} - 1) - 2^n = 2^n(2^{n+1} - 1) - 1 .

The next number after P ( 5 ) P(5) is P ( 6 ) = ( 2 13 1 ) 2 6 = 8127 P(6) = (2^{13} - 1) - 2^6 = 8127 .

Bill Bell
Jan 2, 2015

In a Python interpreter:

Brock Brown
Jan 1, 2015
1
2
3
4
5
6
eye = "1111110111111"
total = 0
for i in xrange(len(eye)):
    if eye[i] == '1':
        total += 2**i
print "Answer:", total

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...