login
A355035
Consider the least base b >= 2 where the sum of digits of n is a prime number; a(n) corresponds to this prime number.
2
2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 3, 3, 2, 2, 2, 3, 2, 3, 3, 5, 2, 3, 3, 3, 3, 3, 2, 5, 2, 2, 2, 3, 2, 3, 3, 3, 2, 3, 3, 5, 3, 3, 7, 5, 2, 3, 3, 5, 3, 7, 2, 5, 3, 3, 7, 5, 5, 5, 5, 3, 13, 2, 2, 3, 2, 3, 3, 7, 2, 3, 3, 5, 3, 7, 3, 5, 2, 3, 3, 3, 3, 3, 5, 5, 3
OFFSET
2,1
LINKS
FORMULA
a(n) = A216789(n, A355034(n)).
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
Cf. A216789, A355034 (corresponding b's).
Sequence in context: A359227 A078178 A306396 * A105068 A363274 A120676
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jun 16 2022
STATUS
approved