login
Number of iterations of (n + lpf(n)) / 2 required to reach a prime, where lpf equals the least prime factor.
1

%I #18 Dec 14 2014 07:32:57

%S 0,0,1,0,2,0,1,3,3,0,1,0,2,4,4,0,4,0,1,2,2,0,1,5,3,5,5,0,5,0,1,5,5,2,

%T 1,0,2,3,3,0,3,0,1,2,2,0,6,6,4,6,6,0,6,6,1,6,6,0,1,0,2,6,6,3,6,0,3,2,

%U 2,0,1,0,3,4,4,4,4,0,1,4,4,0,1,3,2,3,3,0,3,7,1,7,7,5,7,0,5,7,7,0,7,0,1,7,7

%N Number of iterations of (n + lpf(n)) / 2 required to reach a prime, where lpf equals the least prime factor.

%C Zeros indicate prime indices.

%e a(15) gives (15 + 3) / 2 = 9, (9 + 3) / 2 = 6, (6 + 2) / 2 = 4, (4 + 2) / 2 = 3. Four iterations were required to reach a prime, so a(15) = 4.

%t f[n_] := Length@ NestWhileList[(# + FactorInteger[#][[1, 1]])/2 &, n, ! PrimeQ@ # &] - 1; Array[f, 105, 2]

%Y Cf. A177980, A020639, A061228.

%K nonn

%O 2,5

%A _Grant Garcia_, Jan 12 2011