|
|
A249634
|
|
Least number k that is a palindrome in base n but no bases less than n, or 0 if no such k exists.
|
|
3
|
|
|
0, 1, 2, 25, 6, 14, 32, 54, 30, 11, 84, 39, 140, 75, 176, 102, 198, 19, 220, 147, 110, 69, 384, 175, 416, 486, 420, 58, 570, 279, 544, 429, 306, 245, 684, 296, 380, 663, 880, 615, 1134, 258, 1012, 1035, 1104, 47, 1392, 539, 1500, 1071, 1508, 53, 2106, 935, 1736, 1311, 1798, 413, 2940, 671
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
This sequence gives the first occurrence of n in A016026.
"Of course, every positive integer has a palindromic representation in SOME base. If we let f(n) denote the smallest base relative to which n is palindromic, then clearly f(n) is no greater than n-1, because every number n has the palindromic form '11' in the base (n-1)." [See Math Pages link; f(n)=A016026(n).]
|
|
LINKS
|
|
|
EXAMPLE
|
a(6) = 14 because 14_10 equals 22_6. And 14 is the least integer whose representation in base 6 yields a palindrome as its first palindrome. 7, though palindromic in base 6, is also palindromic in a base less than 6 (7_10 = 111_2 = 11_6) so 7 cannot be a(6).
|
|
MAPLE
|
N:= 100: # to get a(1) to a(N)
ispali:= proc(k, b) local L; L:= convert(k, base, b); L = ListTools:-Reverse(L); end proc:
Needed:= N-1:
for k from 1 while Needed > 0 do
for b from 2 to N while not ispali(k, b) do od:
if b <= N and not assigned(A[b]) then A[b]:= k; Needed:= Needed - 1 fi
od:
|
|
MATHEMATICA
|
f[n_] := Block[{b = 2}, While[ Reverse[idn = IntegerDigits[n, b]] != idn, b++]; b]; a = Array[f, 3000]; Table[ Position[a, n, 1, 1], {n, 2, 60}] // Flatten
|
|
PROG
|
(PARI) a(n)=m=1; while(m, c=0; for(k=2, n-1, D=digits(m, k); if(D==Vecrev(D), c++; break)); if(!c&&(d=digits(m, n))==Vecrev(d), return(m)); m++)
print1(0, ", "); for(n=2, 100, print1(a(n), ", ")) \\ Derek Orr, Nov 02 2014
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|