A018845 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.
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, 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, 4, 6, 3, 6, 3, 1, 6, 3, 4, 2, 2, 2, 2, 9, 2, 5, 1, 1, 3
Offset: 2
Examples
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.
Links
- Robert Israel, Table of n, a(n) for n = 2..10000
Programs
-
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 *)
-
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;}
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
Extensions
Corrected by Michel Marcus, Jul 24 2015