OFFSET
1,2
COMMENTS
That is, the sopfr function (see A001414) applied repeatedly until reaching 0 or a fixed point.
For n > 1, the sequence reaches a fixed point which is either 4 or a prime.
A002217(n) is number of terms in sequence from n to a(n). - Reinhard Zumkeller, Apr 08 2003
Because sopfr(n) <= n (with equality at 4 and the primes), the first appearance of all primes is in the natural order: 2,3,5,7,11,... . - Zak Seidov, Mar 14 2011
The terms 0, 2, 3 and 4 occur exactly once, because no number > 5 can have factors that sum to be < 5, and therefore can never enter a trajectory that will drop below 5. - Christian N. K. Anderson, May 19 2013
For all primes p, where p is contained in A001359, then a(p^2) = p + 2. (A006512). Proof: p^2 has prime factors (p, p). This sums to 2p. 2p has factors (2, p). This sums to p + 2. Since p was the lesser of a twin prime, then p + 2 is the greater of a twin prime. - Ryan Bresler, Nov 04 2021
LINKS
Christian N. K. Anderson, Table of n, a(n) for n = 1..10000 (first 1000 terms from T. D. Noe)
Eric Weisstein's World of Mathematics, Sum of Prime Factors.
EXAMPLE
20 -> 2+2+5 = 9 -> 3+3 = 6 -> 2+3 = 5, so a(20)=5.
MAPLE
f:= proc(n) option remember;
if isprime(n) then n
else `procname`(add(x[1]*x[2], x = ifactors(n)[2]))
fi
end proc:
f(1):= 0: f(4):= 4:
map(f, [$1..100]); # Robert Israel, Apr 27 2015
MATHEMATICA
ffi[x_] := Flatten[FactorInteger[x]] lf[x_] := Length[FactorInteger[x]] ba[x_] := Table[Part[ffi[x], 2*w-1], {w, 1, lf[x]}] ep[x_] := Table[Part[ffi[x], 2*w], {w, 1, lf[x]}] slog[x_] := slog[x_] := Apply[Plus, ba[x]*ep[x]] Table[FixedPoint[slog, w], {w, 1, 128}]
f[n_] := Plus @@ Flatten[ Table[ #[[1]], {#[[2]]}] & /@ FactorInteger@n]; Array[ FixedPoint[f, # ] &, 87] (* Robert G. Wilson v, Jan 18 2006 *)
fz[n_]:=Plus@@(#[[1]]*#[[2]]&/@FactorInteger@n); Array[FixedPoint[fz, #]&, 1000] (* Zak Seidov, Mar 14 2011 *)
PROG
(Python)
from sympy import factorint
def a(n, pn):
if n == pn:
return n
else:
return a(sum(p*e for p, e in factorint(n).items()), n)
print([a(i, None) for i in range(1, 100)]) # Gleb Ivanov, Nov 05 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved