login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A039645 Number of steps to fixed point of "k -> k/2 or (k+1)/2 until result is prime", starting with prime(n)+1. 12
1, 2, 2, 3, 3, 2, 3, 3, 4, 5, 5, 2, 3, 3, 5, 4, 6, 2, 3, 5, 2, 5, 4, 3, 4, 4, 4, 5, 5, 3, 7, 4, 6, 6, 4, 4, 2, 3, 5, 5, 4, 4, 7, 2, 5, 5, 3, 6, 4, 4, 3, 8, 3, 8, 5, 5, 5, 5, 2, 3, 3, 4, 7, 7, 2, 7, 3, 4, 6, 6, 3, 5, 5, 4, 8, 8, 6, 2, 3, 3, 4, 2, 7, 3, 7, 7, 3, 2, 5, 5, 4, 9, 4, 5, 9, 9, 9, 3, 3, 2, 3, 8 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
MATHEMATICA
f[k_] := Which[PrimeQ[k], k, EvenQ[k], k/2, True, (k+1)/2];
a[n_] := Length[FixedPointList[f, Prime[n] + 1]] - 1;
Array[a, 102] (* Jean-François Alcover, Mar 01 2019 *)
PROG
(Haskell)
a039645 n = snd $ until ((== 1) . a010051 . fst)
(\(x, i) -> ((x + 1) `div` 2 , i + 1)) (a000040 n + 1, 1)
-- Reinhard Zumkeller, Nov 17 2013
CROSSREFS
Sequence in context: A245908 A023514 A179751 * A317993 A048687 A308621
KEYWORD
nonn
AUTHOR
EXTENSIONS
Offset corrected by Reinhard Zumkeller, Nov 17 2013
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 07:54 EDT 2024. Contains 371922 sequences. (Running on oeis4.)