OFFSET
2,1
LINKS
Rémy Sigrist, Table of n, a(n) for n = 2..10000
EXAMPLE
For n = 16:
- we have the following expansions and sum of digits:
b 16_b Sum of digits in base b
- ------- -----------------------
2 "10000" 1
3 "121" 4
4 "100" 1
5 "31" 4
6 "24" 6
7 "22" 4
8 "20" 2
- so a(16) = 2.
PROG
(PARI) a(n) = my (s); for (b=2, oo, if (isprime(s=sumdigits(n, b)), return (s)))
(Python)
from sympy import isprime
from sympy.ntheory.digits import digits
def s(n, b): return sum(digits(n, b)[1:])
def a(n):
b = 2
while not isprime(s(n, b)): b += 1
return s(n, b)
print([a(n) for n in range(2, 89)]) # Michael S. Branicky, Jun 16 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jun 16 2022
STATUS
approved