OFFSET
1,1
COMMENTS
From the Kreher and Stinson article we know that a(n) is of the form 2^k-1 (cf. A000225). - David A. Corneth, Jan 18 2024
LINKS
David A. Corneth, Table of n, a(n) for n = 1..10000 (first 400 terms from Michel Marcus)
Donald L. Kreher and Douglas R. Stinson, On min-base palindromic representations of powers of 2, arXiv:2401.07351 [math.NT], 2024. See Table 3 p. 7.
MAPLE
f:= proc(n) local x, b, L, i;
x:= 2^n;
for b from 3 do
L:= convert(x, base, b);
if andmap(i -> L[i]=L[-i], [$1..nops(L)/2]) then return b fi
od
end proc:
map(f, [$1..100]); # Robert Israel, Jan 17 2024
MATHEMATICA
A369233[n_] := Block[{p = 2^n, k = 1}, While[!PalindromeQ[IntegerDigits[p, 2^++k-1]]]; 2^k-1]; Array[A369233, 100] (* Paolo Xausa, Mar 10 2024 *)
PROG
(PARI) ispal(n, b) = my(d=digits(n, b)); d == Vecrev(d);
a(n) = my(b=2, N=2^n); while (! ispal(N, b), b++); b;
(PARI) a(n) = {my(pow2 = 1<<n, i, d); for(i = 2, max(n, 2), d = digits(pow2, 1<<i-1); if(Vecrev(d) == d, return(1<<i-1)))} \\ David A. Corneth, Jan 18 2024
(Python)
from itertools import count
from sympy.ntheory.factor_ import digits
def A369233(n):
m = 1<<n
return next(b for b in count(2) if (s := digits(m, b)[1:])[:(t:=len(s)+1>>1)]==s[:-t-1:-1]) # Chai Wah Wu, Jan 17 2024
CROSSREFS
KEYWORD
AUTHOR
Michel Marcus, Jan 17 2024
STATUS
approved