login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A039636
Number of steps to fixed point of "n -> n/2 or (n-1)/2 until result is prime".
6
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,4
LINKS
MATHEMATICA
nerlist[ n_Integer ] := Length/@Drop[ FixedPointList[ If[ EvenQ[ # ]&&#>2, #/ 2, If[ PrimeQ[ # ]||(#===1), #, (#-1)/2 ] ]&, n, 20 ], -1 ]
PROG
(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
CROSSREFS
KEYWORD
nonn
EXTENSIONS
Offset corrected by Reinhard Zumkeller, Nov 17 2013
STATUS
approved