cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A369233 Smallest base for which the digits expansion of 2^n is palindromic.

This page as a plain text file.
%I A369233 #31 Mar 10 2024 16:36:36
%S A369233 3,3,3,3,7,7,7,15,7,7,31,7,15,15,31,15,15,31,63,15,31,31,127,63,31,31,
%T A369233 63,127,127,31,63,63,255,255,127,63,63,127,511,255,255,63,127,127,511,
%U A369233 511,511,255,127,127,255,1023,1023,511,511,127,255,255,2047,1023,1023,1023,127,255
%N A369233 Smallest base for which the digits expansion of 2^n is palindromic.
%C A369233 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
%H A369233 David A. Corneth, <a href="/A369233/b369233.txt">Table of n, a(n) for n = 1..10000</a> (first 400 terms from Michel Marcus)
%H A369233 Donald L. Kreher and Douglas R. Stinson, <a href="https://arxiv.org/abs/2401.07351">On min-base palindromic representations of powers of 2</a>, arXiv:2401.07351 [math.NT], 2024. See Table 3 p. 7.
%F A369233 a(n) = A016026(A000079(n)).
%p A369233 f:= proc(n) local x,b,L,i;
%p A369233   x:= 2^n;
%p A369233   for b from 3 do
%p A369233     L:= convert(x,base,b);
%p A369233     if andmap(i -> L[i]=L[-i], [$1..nops(L)/2]) then return b fi
%p A369233   od
%p A369233 end proc:
%p A369233 map(f,[$1..100]); # _Robert Israel_, Jan 17 2024
%t A369233 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 *)
%o A369233 (PARI) ispal(n, b) = my(d=digits(n, b)); d == Vecrev(d);
%o A369233 a(n) = my(b=2, N=2^n); while (! ispal(N, b), b++); b;
%o A369233 (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
%o A369233 (Python)
%o A369233 from itertools import count
%o A369233 from sympy.ntheory.factor_ import digits
%o A369233 def A369233(n):
%o A369233     m = 1<<n
%o A369233     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
%Y A369233 Cf. A000079, A000225, A016026.
%K A369233 nonn,base,look
%O A369233 1,1
%A A369233 _Michel Marcus_, Jan 17 2024