login
Number of steps needed to reach a prime starting with n and iterating x-->floor(3x/2).
0

%I #8 Nov 21 2013 12:47:59

%S 1,4,3,1,2,6,12,1,5,7,11,1,2,4,6,2,10,6,3,1,3,18,5,1,93,9,5,1,2,3,35,

%T 2,17,8,4,27,3,92,8,1,4,8,6,1,2,3,34,1,13,16,7,1,3,26,4,2,91,20,7,53,

%U 2,3,7,1,5,4,3,1,2,25,33,1,4,12,15,33,6,4,5,2,25,13,3,1,2,90,19,2,6,52,7,1

%N Number of steps needed to reach a prime starting with n and iterating x-->floor(3x/2).

%C If the starting n is itself a prime, it counts as a step but the iteration continues despite its prime status (see the example). [From Harvey P. Dale, Nov 11 2011]

%e 3-->4-->6-->9-->13. Hence 4 steps are needed and a(3)=4.

%t Table[Length[NestWhileList[Floor[(3 #)/2]&,Floor[(3n)/2],!PrimeQ[#]&]], {n,2,100}] (* _Harvey P. Dale_, Nov 11 2011 *)

%K nonn

%O 2,2

%A _Benoit Cloitre_, Mar 08 2003