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!)
A039636 Number of steps to fixed point of "n -> n/2 or (n-1)/2 until result is prime". 6

%I #10 Nov 17 2013 14:51:22

%S 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,

%T 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,

%U 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

%N Number of steps to fixed point of "n -> n/2 or (n-1)/2 until result is prime".

%H Reinhard Zumkeller, <a href="/A039636/b039636.txt">Table of n, a(n) for n = 1..10000</a>

%t nerlist[ n_Integer ] := Length/@Drop[ FixedPointList[ If[ EvenQ[ # ]&&#>2, #/ 2, If[ PrimeQ[ # ]||(#===1), #, (#-1)/2 ] ]&, n, 20 ], -1 ]

%o (Haskell)

%o a039636 1 = 1

%o a039636 n = snd $ until ((== 1) . a010051 . fst)

%o (\(x, i) -> (x `div` 2 , i + 1)) (n, 1)

%o -- _Reinhard Zumkeller_, Nov 17 2013

%Y Cf. A039634-A039645.

%Y Cf. A010051, A039634, A039637, A039642, A039643.

%K nonn

%O 1,4

%A _Wouter Meeussen_

%E Offset corrected by _Reinhard Zumkeller_, Nov 17 2013

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 May 10 01:03 EDT 2024. Contains 372354 sequences. (Running on oeis4.)