OFFSET
0,3
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
LINKS
David A. Corneth, Table of n, a(n) for n = 0..9999
EXAMPLE
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.
PROG
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 28 2019
STATUS
approved