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!)
A211187 a(n) = smallest r>=2 such that the digits of n in base r form a permutation of {0,1,...,s-1} for some s<=r. 1
2, 2, 2, 3, 4, 3, 4, 3, 6, 4, 8, 3, 10, 6, 12, 3, 14, 8, 4, 3, 18, 3, 20, 11, 4, 12, 24, 4, 26, 14, 4, 15, 30, 4, 32, 5, 4, 18, 5, 4, 38, 20, 5, 21, 42, 4, 44, 23, 6, 24, 48, 5, 50, 26, 4, 5, 6, 4, 5, 29, 58, 30, 60, 7, 62, 32, 5, 33, 66, 34, 68, 35, 7, 6, 72, 4, 74, 38, 4, 39, 8, 6, 5, 8, 82, 42, 5, 43, 86, 44, 8, 6, 90, 46, 92, 47, 94, 48, 96, 4, 98, 50, 9, 51, 102, 7, 104, 53, 4, 54, 9, 55, 110, 56, 4, 57, 6 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
COMMENTS
In base r the first zero is allowed if there is no zero to the right.
LINKS
EXAMPLE
1) Let n=5. For r=2, (5)_2=101, for r=3, (5)_3=012. Thus a(5)=3.
2) Let n=18. For r=2, (18)_2=10010, for r=3, (18)_3=200, (18)_4=102. Since {1,0,2} is a permutation of {0,1,2}, a(18)=4.
MATHEMATICA
Table[NestWhile[#1+1&, 2, (!(#1+1==#2||#1==#2&)[Sort[#1], Range[Length[#1]]]&)[IntegerDigits[n, #1]]&], {n, 0, 200}]
PROG
(PARI) isperm(N)={my(c:small, x:vec, y:vecsmall, z:vecsmall); for(B=2, max(2, N-1), y=Vecsmall(digits(N, B)); x=vector(#y, i, i); for(i=1, #y, if(!y[i], y[i]=x[#x]; break)); z=Vecsmall(0, #y); c=0; for(i=1, #y, c+=vecsearch(x, y[i])&&if(!z[y[i]], z[y[i]]=1; 1, break)); if(c==#y, return(B))); return(0)}
a(n)={my(c=isperm(n)); if(!c, max(2, n), c)} \\ R. J. Cano, May 14 2017
CROSSREFS
Sequence in context: A152803 A347102 A187181 * A241504 A342247 A016729
KEYWORD
nonn,base
AUTHOR
Vladimir Shevelev, Feb 03 2013
STATUS
approved

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 April 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)