This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A018845 #27 Jul 19 2020 04:28:11 %S A018845 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 A018845 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 A018845 4,6,3,6,3,1,6,3,4,2,2,2,2,9,2,5,1,1,3 %N 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. %H A018845 Robert Israel, <a href="/A018845/b018845.txt">Table of n, a(n) for n = 2..10000</a> %F A018845 Factor n, add n and its prime divisors. Sum = t, t replaces n, repeat until a prime is produced in k iterations. %F A018845 For x in A050703, a(x) = 1. - _Michel Marcus_, Jul 24 2015 %F A018845 Number of iterations x->A075254(x) to reach a prime, starting at x=n. - _R. J. Mathar_, Jul 27 2015 %e A018845 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 A018845 f:= proc(n) option remember; local t; %p A018845 t:= n + convert(map(convert,ifactors(n)[2],`*`),`+`); %p A018845 if isprime(t) then 1 else 1+procname(t) fi %p A018845 end proc: %p A018845 map(f, [$2..100]); # _Robert Israel_, Jul 26 2015 %t A018845 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 A018845 a /@ Range[2, 100] (* _Jean-François Alcover_, Jul 19 2020, after Maple *) %o A018845 (PARI) sfpn(n) = {my(f = factor(n)); n + sum(k=1, #f~, f[k,1]*f[k,2]);} %o A018845 a(n) = {nb = 1; while (! isprime(t=sfpn(n)), n=t; nb++); nb;} %Y A018845 Cf. A016837, A050703, A075254. %K A018845 easy,nonn %O A018845 2,1 %A A018845 _Enoch Haga_, _Carlos Rivera_, _Patrick De Geest_ %E A018845 Corrected by _Michel Marcus_, Jul 24 2015