A039644 Number of steps to fixed point of "k -> k/2 or (k+1)/2 until result is prime", starting with prime(n)-1.
1, 1, 2, 2, 2, 3, 4, 3, 2, 3, 5, 4, 4, 3, 2, 3, 2, 6, 3, 5, 5, 5, 2, 4, 6, 4, 4, 2, 5, 5, 7, 4, 4, 6, 3, 4, 6, 3, 2, 3, 2, 4, 7, 7, 5, 5, 3, 6, 2, 4, 4, 8, 8, 8, 8, 2, 3, 5, 7, 7, 3, 3, 7, 7, 7, 3, 3, 6, 2, 6, 6, 2, 5, 4, 8, 2, 3, 6, 6, 6, 4, 4, 7, 7, 7, 7, 7, 5, 5, 5, 2, 2, 4, 5, 9, 2, 3, 6, 3, 6, 3, 3
Offset: 1
Keywords
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Programs
-
Haskell
a039644 1 = 1 a039644 n = snd $ until ((== 1) . a010051 . fst) (\(x, i) -> ((x + 1) `div` 2 , i + 1)) (a000040 n - 1, 1) -- Reinhard Zumkeller, Nov 17 2013
-
Mathematica
(* See A039637. *)
Extensions
Offset corrected by Reinhard Zumkeller, Nov 17 2013