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.

A326775 For any n >= 0, let b >= 2 be the smallest base where n has all digits equal, say to d; a(n) = d.

Original entry on oeis.org

0, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 4, 1, 2, 3, 4, 1, 3, 1, 4, 3, 2, 5, 4, 1, 2, 3, 1, 1, 2, 1, 4, 5, 2, 1, 6, 1, 5, 3, 4, 1, 6, 5, 4, 1, 2, 1, 6, 1, 2, 1, 4, 5, 6, 1, 4, 3, 7, 1, 6, 1, 2, 5, 4, 7, 6, 1, 2, 3, 2, 1, 7, 1, 2
Offset: 0

Views

Author

Rémy Sigrist, Jul 28 2019

Keywords

Comments

A059711 gives base b.
From Bernard Schott, Aug 17 2019: (Start)
a(n) = 1 iff n is A220570, then n = 11_(n-1) or, n is in A053696, then n = 11..11_b for some base b.
a(n) = 2 if n = 2 * p, p prime >= 5.
a(n) = 3 if n = 3 * p, p prime >= 11.
There are k = 2 equal digits in the representation of n in the corresponding base b, except when n is a term of A167782, in which case the number k of equal digits is >= 3. (End)
n = (b^k - 1)/(b - 1) * a(n) so a(n) | n for n > 0. Furthermore a(n) <= sqrt(n). - David A. Corneth, Aug 21 2019
If b is the smallest base such that n=d*b^k+...+d*b^0 (A059711) (d=a(n) is the repdigit) then n mod b = (d*b^k+...+d*b^0) mod b = (d*b^k+...+d*b^1) mod b + (d*b^0) mod b = 0 + (d*1) mod b. Since d is less than the base we end up with the formula n mod b = d. - Jon Maiga, May 31 2021

Examples

			For n = 45:
- we have:
     b  45 in base b  Repdigit ?
     -  ------------  ----------
     2  101101        no
     3  1200          no
     4  231           no
     5  140           no
     6  113           no
     7  63            no
     8  55            yes, with d = 5
- hence a(45) = 5.
		

Crossrefs

Programs

  • PARI
    a(n) = for (b=2, oo, if (#Set(digits(n,b))<=1, return (n%b)))
    
  • Python
    # with library / without (faster for large n)
    from sympy.ntheory import digits
    def is_repdigit(n, b): return len(set(digits(n, b)[1:])) == 1
    def is_repdigit(n, b):
      if n < b: return True
      n, r = divmod(n, b)
      onlyd = r
      while n > b:
        n, r = divmod(n, b)
        if r != onlyd: return False
      return n == onlyd
    def a(n):
      for b in range(2, n+3):
        if is_repdigit(n, b): return n%b
    print([a(n) for n in range(87)]) # Michael S. Branicky, May 31 2021

Formula

n is a multiple of a(n).
a(n) = n mod A059711(n). - Jon Maiga, May 31 2021