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.

A249634 Least number k that is a palindrome in base n but no bases less than n, or 0 if no such k exists.

This page as a plain text file.
%I A249634 #28 Nov 12 2014 03:56:09
%S A249634 0,1,2,25,6,14,32,54,30,11,84,39,140,75,176,102,198,19,220,147,110,69,
%T A249634 384,175,416,486,420,58,570,279,544,429,306,245,684,296,380,663,880,
%U A249634 615,1134,258,1012,1035,1104,47,1392,539,1500,1071,1508,53,2106,935,1736,1311,1798,413,2940,671
%N A249634 Least number k that is a palindrome in base n but no bases less than n, or 0 if no such k exists.
%C A249634 This sequence gives the first occurrence of n in A016026.
%C A249634 "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).]
%H A249634 Robert G. Wilson v, <a href="/A249634/b249634.txt">Table of n, a(n) for n = 1..1000</a>
%H A249634 Math Pages, <a href="http://www.mathpages.com/home/kmath359.htm"> On General Palindromic Numbers</a>
%e A249634 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).
%p A249634 N:= 100: # to get a(1) to a(N)
%p A249634 ispali:= proc(k,b) local L; L:= convert(k,base,b); L = ListTools:-Reverse(L); end proc:
%p A249634 Needed:= N-1:
%p A249634 for k from 1 while Needed > 0 do
%p A249634    for b from 2 to N while not ispali(k,b) do od:
%p A249634    if b <= N and not assigned(A[b]) then A[b]:= k; Needed:= Needed - 1 fi
%p A249634 od:
%p A249634 0, seq(A[n],n=1..N); # _Robert Israel_, Nov 04 2014
%t A249634 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
%o A249634 (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++)
%o A249634 print1(0,", ");for(n=2,100,print1(a(n),", ")) \\ _Derek Orr_, Nov 02 2014
%Y A249634 Cf. A016026.
%K A249634 nonn,base,easy
%O A249634 1,3
%A A249634 _Robert G. Wilson v_, Nov 02 2014