|
|
A029908
|
|
Starting with n, repeatedly sum prime factors (with multiplicity) until reaching 0 or a fixed point. Then a(n) is the fixed point (or 0).
|
|
13
|
|
|
0, 2, 3, 4, 5, 5, 7, 5, 5, 7, 11, 7, 13, 5, 5, 5, 17, 5, 19, 5, 7, 13, 23, 5, 7, 5, 5, 11, 29, 7, 31, 7, 5, 19, 7, 7, 37, 7, 5, 11, 41, 7, 43, 5, 11, 7, 47, 11, 5, 7, 5, 17, 53, 11, 5, 13, 13, 31, 59, 7, 61, 5, 13, 7, 5, 5, 67, 7, 5, 5, 71, 7, 73, 5, 13, 23, 5, 5, 79, 13, 7, 43, 83, 5, 13
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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.
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
|
|
|
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:
|
|
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
|
Cf. A001414 (sum of prime factors of n).
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|