login
A356552
a(n) is the least base b > 1 where the sum of digits of n divides n.
6
2, 2, 3, 2, 5, 2, 7, 2, 3, 2, 11, 2, 13, 7, 3, 2, 17, 2, 19, 2, 2, 11, 23, 2, 3, 5, 3, 3, 29, 3, 31, 2, 3, 2, 3, 2, 37, 19, 3, 2, 41, 2, 43, 6, 3, 23, 47, 2, 7, 4, 5, 4, 53, 3, 2, 3, 3, 29, 59, 2, 61, 31, 3, 2, 3, 2, 67, 2, 2, 6, 71, 2, 73, 37, 3, 4, 3, 3, 79
OFFSET
1,1
COMMENTS
This sequence is well defined: a(1) = 2, and for n > 1, the sum of digits of n in base n equals 1, which divides n.
See A356553 for the corresponding sum of digits.
LINKS
FORMULA
a(n) = 2 iff n belongs to A049445.
a(n) = n iff n is prime.
EXAMPLE
For n = 14:
- we have:
b sum of digits divides 14?
-- ------------- -----------
2 3 no
3 4 no
4 5 no
5 6 no
6 4 no
7 2 yes
- so a(14) = 7.
MATHEMATICA
a[n_] := Module[{b = 2}, While[!Divisible[n, Plus @@ IntegerDigits[n, b]], b++]; b]; Array[a, 100] (* Amiram Eldar, Aug 15 2022 *)
PROG
(PARI) a(n) = { for (b=2, oo, if (n % sumdigits(n, b)==0, return (b))) }
(Python)
from sympy.ntheory import digits
def a(n):
b = 2
while n != 0 and n%sum(digits(n, b)[1:]): b += 1
return b
print([a(n) for n in range(1, 80)]) # Michael S. Branicky, Aug 12 2022
CROSSREFS
Sequence in context: A304716 A237984 A118136 * A258567 A076396 A370834
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Aug 12 2022
STATUS
approved