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.

A123699 Smallest b such that all digits are distinct in base b representation of n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Oct 08 2006

Keywords

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

Examples

			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.
		

Crossrefs

Programs

  • 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 *)
  • 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