%I #27 Jul 19 2020 04:28:11
%S 4,2,3,2,1,2,2,2,1,3,1,2,1,1,3,2,2,2,1,1,2,2,2,2,1,3,3,2,3,5,4,1,1,1,
%T 2,2,1,2,2,10,3,2,1,6,1,3,1,5,5,1,5,3,2,1,5,1,1,2,7,3,4,4,4,1,10,3,1,
%U 4,6,3,6,3,1,6,3,4,2,2,2,2,9,2,5,1,1,3
%N Number of iterations required for the sum of n and its prime divisors = t to reach a prime (where t replaces n in each iteration) in A016837.
%H Robert Israel, <a href="/A018845/b018845.txt">Table of n, a(n) for n = 2..10000</a>
%F Factor n, add n and its prime divisors. Sum = t, t replaces n, repeat until a prime is produced in k iterations.
%F For x in A050703, a(x) = 1. - _Michel Marcus_, Jul 24 2015
%F Number of iterations x->A075254(x) to reach a prime, starting at x=n. - _R. J. Mathar_, Jul 27 2015
%e 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.
%p f:= proc(n) option remember; local t;
%p t:= n + convert(map(convert,ifactors(n)[2],`*`),`+`);
%p if isprime(t) then 1 else 1+procname(t) fi
%p end proc:
%p map(f, [$2..100]); # _Robert Israel_, Jul 26 2015
%t a[n_] := a[n] = Module[{t, f = FactorInteger[n]}, t = n + f[[All, 1]]. f[[All, 2]]; If[PrimeQ[t], 1, 1 + a[t]]];
%t a /@ Range[2, 100] (* _Jean-François Alcover_, Jul 19 2020, after Maple *)
%o (PARI) sfpn(n) = {my(f = factor(n)); n + sum(k=1, #f~, f[k,1]*f[k,2]);}
%o a(n) = {nb = 1; while (! isprime(t=sfpn(n)), n=t; nb++); nb;}
%Y Cf. A016837, A050703, A075254.
%K easy,nonn
%O 2,1
%A _Enoch Haga_, _Carlos Rivera_, _Patrick De Geest_
%E Corrected by _Michel Marcus_, Jul 24 2015