A039636 Number of steps to fixed point of "n -> n/2 or (n-1)/2 until result is prime".
1, 1, 1, 2, 1, 2, 1, 3, 3, 2, 1, 3, 1, 2, 2, 4, 1, 4, 1, 3, 3, 2, 1, 4, 4, 2, 2, 3, 1, 3, 1, 5, 5, 2, 2, 5, 1, 2, 2, 4, 1, 4, 1, 3, 3, 2, 1, 5, 5, 5, 5, 3, 1, 3, 3, 4, 4, 2, 1, 4, 1, 2, 2, 6, 6, 6, 1, 3, 3, 3, 1, 6, 1, 2, 2, 3, 3, 3, 1, 5, 5, 2, 1, 5, 5, 2, 2, 4, 1, 4, 4, 3, 3, 2, 2, 6, 1, 6, 6, 6, 1, 6
Offset: 1
Keywords
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Programs
-
Haskell
a039636 1 = 1 a039636 n = snd $ until ((== 1) . a010051 . fst) (\(x, i) -> (x `div` 2 , i + 1)) (n, 1) -- Reinhard Zumkeller, Nov 17 2013
-
Mathematica
nerlist[ n_Integer ] := Length/@Drop[ FixedPointList[ If[ EvenQ[ # ]&>2, #/ 2, If[ PrimeQ[ # ]||(#===1), #, (#-1)/2 ] ]&, n, 20 ], -1 ]
Extensions
Offset corrected by Reinhard Zumkeller, Nov 17 2013