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.
%I A326775 #49 May 31 2021 21:36:47 %S A326775 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, %T A326775 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, %U A326775 4,3,7,1,6,1,2,5,4,7,6,1,2,3,2,1,7,1,2 %N A326775 For any n >= 0, let b >= 2 be the smallest base where n has all digits equal, say to d; a(n) = d. %C A326775 A059711 gives base b. %C A326775 From _Bernard Schott_, Aug 17 2019: (Start) %C A326775 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. %C A326775 a(n) = 2 if n = 2 * p, p prime >= 5. %C A326775 a(n) = 3 if n = 3 * p, p prime >= 11. %C A326775 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) %C A326775 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 %C A326775 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 %H A326775 David A. Corneth, <a href="/A326775/b326775.txt">Table of n, a(n) for n = 0..9999</a> %F A326775 n is a multiple of a(n). %F A326775 a(n) = n mod A059711(n). - _Jon Maiga_, May 31 2021 %e A326775 For n = 45: %e A326775 - we have: %e A326775 b 45 in base b Repdigit ? %e A326775 - ------------ ---------- %e A326775 2 101101 no %e A326775 3 1200 no %e A326775 4 231 no %e A326775 5 140 no %e A326775 6 113 no %e A326775 7 63 no %e A326775 8 55 yes, with d = 5 %e A326775 - hence a(45) = 5. %o A326775 (PARI) a(n) = for (b=2, oo, if (#Set(digits(n,b))<=1, return (n%b))) %o A326775 (Python) # with library / without (faster for large n) %o A326775 from sympy.ntheory import digits %o A326775 def is_repdigit(n, b): return len(set(digits(n, b)[1:])) == 1 %o A326775 def is_repdigit(n, b): %o A326775 if n < b: return True %o A326775 n, r = divmod(n, b) %o A326775 onlyd = r %o A326775 while n > b: %o A326775 n, r = divmod(n, b) %o A326775 if r != onlyd: return False %o A326775 return n == onlyd %o A326775 def a(n): %o A326775 for b in range(2, n+3): %o A326775 if is_repdigit(n, b): return n%b %o A326775 print([a(n) for n in range(87)]) # _Michael S. Branicky_, May 31 2021 %Y A326775 Cf. A059711, A053696, A060775, A220570. %K A326775 nonn,base %O A326775 0,3 %A A326775 _Rémy Sigrist_, Jul 28 2019