1
$\begingroup$

I manually checked the first 20 base 2 palindromes and I did not find any base 3 palindromes among them.

Is there any definite way of determining this? What about other bases?

  • 0
    Our current year, 2017, is actually the smallest positive integer which is a palindrome in two consecutive bases - base 31 and 32.2017-02-03
  • 0
    @mathematics2x2life Can you tell me the source?2017-02-03
  • 0
    @S.C.B.: One place that cites it, though not as the smallest, is http://a-number-a-day.blogspot.com/2017/01/number-of-day-2017.html2017-02-03
  • 0
    @S.C.B. I have not checked it for myself but it was claimed in this video: https://www.youtube.com/watch?v=z6jMU-AwX34 . But if it's on the internet it certainly must be true!2017-02-03

1 Answers 1

3

Note that what you are looking for is basically the sequence $\text{A0607092}$ on OEIS.

However, examining the comments on the OEIS page, it seems unlikely that we will find a closed form for all such $n$ that satisfies the condition. Also, it seems that such $n$ grows very quickly. You probably should just write a code.

A collections of code can be seen here. For example, you can code this on Python by

from itertools import islice

digits = "0123456789abcdefghijklmnopqrstuvwxyz"

def baseN(num,b):
  if num == 0: return "0"
  result = ""
  while num != 0:
    num, d = divmod(num, b)
    result += digits[d]
  return result[::-1] # reverse

def pal2(num):
    if num == 0 or num == 1: return True
    based = bin(num)[2:]
    return based == based[::-1]

def pal_23():
    yield 0
    yield 1
    n = 1
    while True:
        n += 1
        b = baseN(n, 3)
        revb = b[::-1]
        #if len(b) > 12: break
        for trial in ('{0}{1}'.format(b, revb), '{0}0{1}'.format(b, revb),
                      '{0}1{1}'.format(b, revb), '{0}2{1}'.format(b, revb)):
            t = int(trial, 3)
            if pal2(t):
                yield t

for pal23 in islice(pal_23(), 6):
    print(pal23, baseN(pal23, 3), baseN(pal23, 2))