OFFSET
1,2
COMMENTS
Can be understood as an exotic way of measuring how far a number is from being prime, since omitting n = 1, 4, |a(n) - n| = 0 if and only if n is prime. Note that A274718(n) = k - 1 when a(n) = b(n) + b(b(n)) + ... + b^k(n). The scatter plot for n >= 10000 shows intriguing regularities.
EXAMPLE
a(24) is computed as follows: 24 = (2^3) * 3, 2 * 3 + 3 = 9. 9 = (3^2), 3 + 3 = 6. 6 = 2 * 3, 2 + 3 = 5. Since 5 is prime, we stop and take the sum: 9 + 6 + 5 = 20.
PROG
(Python)
from sympy import*
def a(n):
t=0
while n not in (1, 4) and not isprime(n):
n=sum(p*e for p, e in factorint(n).items()); t+=n
return t or n
CROSSREFS
KEYWORD
AUTHOR
Louis-Simon Cyr, Oct 29 2024
STATUS
approved