A054575 Number of iterations to reach new prime in A054574.
4, 2, 2, 2, 3, 2, 2, 2, 2, 2, 5, 2, 10, 2, 3, 3, 2, 3, 3, 3, 3, 2, 2, 2, 2, 4, 2, 3, 3, 3, 2, 3, 3, 2, 2, 6, 18, 2, 2, 2, 16, 3, 16, 4, 2, 2, 4, 3, 2, 4, 2, 2, 5, 3, 2, 3, 2, 3, 4, 6, 3, 2, 12, 10, 2, 2, 4, 2, 4, 2, 2, 10, 2, 4, 3, 2, 4, 2, 3, 2, 2, 9, 6, 2, 2, 20, 3, 2, 3, 3, 3, 2, 10, 15, 2, 2, 11, 10
Offset: 1
Examples
a(5)=3 because beginning at 11, the next prime, 47, is attained in 3 steps.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A054574.
Programs
-
Mathematica
f[n_] := n + Plus @@ Times @@@ FactorInteger@n; a[n_] := Length[NestWhileList[f, (p = Prime[n]), # == p || CompositeQ[#] &]] - 1; Array[a, 100] (* Amiram Eldar, Sep 07 2019 *)
Comments