login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I #28 Nov 12 2014 03:56:09

%S 0,1,2,25,6,14,32,54,30,11,84,39,140,75,176,102,198,19,220,147,110,69,

%T 384,175,416,486,420,58,570,279,544,429,306,245,684,296,380,663,880,

%U 615,1134,258,1012,1035,1104,47,1392,539,1500,1071,1508,53,2106,935,1736,1311,1798,413,2940,671

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

%C This sequence gives the first occurrence of n in A016026.

%C "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 Robert G. Wilson v, <a href="/A249634/b249634.txt">Table of n, a(n) for n = 1..1000</a>

%H Math Pages, <a href="http://www.mathpages.com/home/kmath359.htm"> On General Palindromic Numbers</a>

%e 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 N:= 100: # to get a(1) to a(N)

%p ispali:= proc(k,b) local L; L:= convert(k,base,b); L = ListTools:-Reverse(L); end proc:

%p Needed:= N-1:

%p for k from 1 while Needed > 0 do

%p for b from 2 to N while not ispali(k,b) do od:

%p if b <= N and not assigned(A[b]) then A[b]:= k; Needed:= Needed - 1 fi

%p od:

%p 0, seq(A[n],n=1..N); # _Robert Israel_, Nov 04 2014

%t 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 (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 print1(0,", ");for(n=2,100,print1(a(n),", ")) \\ _Derek Orr_, Nov 02 2014

%Y Cf. A016026.

%K nonn,base,easy

%O 1,3

%A _Robert G. Wilson v_, Nov 02 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 1 11:43 EDT 2024. Contains 375589 sequences. (Running on oeis4.)