OFFSET
2,1
LINKS
Robert Israel, Table of n, a(n) for n = 2..10000
FORMULA
Factor n, add n and its prime divisors. Sum = t, t replaces n, repeat until a prime is produced in k iterations.
For x in A050703, a(x) = 1. - Michel Marcus, Jul 24 2015
Number of iterations x->A075254(x) to reach a prime, starting at x=n. - R. J. Mathar, Jul 27 2015
EXAMPLE
Starting with 4, 4=2*2, so 4+2+2=8. 8=2*2*2 so 8+2+2+2=14. 14=2*7 so 14+2+7=23, prime in 3 iterations, so a(4)=3.
MAPLE
f:= proc(n) option remember; local t;
t:= n + convert(map(convert, ifactors(n)[2], `*`), `+`);
if isprime(t) then 1 else 1+procname(t) fi
end proc:
map(f, [$2..100]); # Robert Israel, Jul 26 2015
MATHEMATICA
a[n_] := a[n] = Module[{t, f = FactorInteger[n]}, t = n + f[[All, 1]]. f[[All, 2]]; If[PrimeQ[t], 1, 1 + a[t]]];
a /@ Range[2, 100] (* Jean-François Alcover, Jul 19 2020, after Maple *)
PROG
(PARI) sfpn(n) = {my(f = factor(n)); n + sum(k=1, #f~, f[k, 1]*f[k, 2]); }
a(n) = {nb = 1; while (! isprime(t=sfpn(n)), n=t; nb++); nb; }
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
EXTENSIONS
Corrected by Michel Marcus, Jul 24 2015
STATUS
approved