login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A123699
Smallest b such that all digits are distinct in base b representation of n.
3
1, 2, 3, 4, 3, 3, 3, 4, 4, 5, 3, 4, 4, 4, 3, 5, 5, 4, 3, 5, 3, 5, 5, 4, 6, 6, 4, 4, 5, 4, 6, 6, 4, 6, 4, 4, 7, 5, 4, 5, 6, 5, 7, 4, 4, 7, 5, 5, 4, 4, 5, 4, 5, 4, 5, 4, 4, 5, 5, 6, 8, 6, 6, 9, 5, 5, 7, 6, 5, 5, 5, 7, 5, 7, 4, 5, 5, 4, 5, 5, 6, 5, 6, 5, 5, 5, 7, 7, 5, 6, 6, 8, 7, 6, 5, 5, 5, 8, 4, 11, 5, 5, 5, 7, 5
OFFSET
1,2
COMMENTS
a(A123700(n)) = n and a(m) <> n for m < A123700(n).
See A126688 for another version of the same sequence. - R. J. Mathar, Jun 15 2008
LINKS
EXAMPLE
n=10: 1010 [b=2] = 101 [b=3] = 22 [b=4] = 20 [b=5]: a(10)=5;
n=11: 1011 [b=2] = 102 [b=3]: a(11)=3;
n=12: 1100 [b=2] = 110 [b=3] = 30 [b=4]: a(12)=4;
n=13: 1101 [b=2] = 111 [b=3] = 31 [b=4]: a(13)=4;
n=14: 1110 [b=2] = 112 [b=3] = 32 [b=4]: a(14)=4;
n=15: 1111 [b=2] = 120 [b=3]: a(15)=3.
MATHEMATICA
s={}; Do[b=1; Until[id= IntegerDigits[n, b]; Length[id]==CountDistinct[id], b++]; AppendTo[s, b], {n, 2, 105}]; Join[{1}, s] (* James C. McMahon, Nov 24 2024 *)
PROG
(PARI) a(n) = if (n==1, 1, my(b = 2, do = 1); while (do, vb = digits(n, b); if (#vb == #Set(vb), do = 0, b++); ); b); \\ Michel Marcus, Jun 09 2013; corrected Jun 14 2022
(Python)
from sympy.ntheory.digits import digits
def distinct(n, b): d = digits(n, b); return len(d) == len(set(d))
def a(n):
if n == 1: return 1
b = 2
while not distinct(n, b): b += 1
return b
print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Jun 15 2022
CROSSREFS
Sequence in context: A101497 A274007 A065870 * A322808 A352899 A119352
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, Oct 08 2006
STATUS
approved