login
Fixed point of "k -> k/2 or (k+1)/2 until result is prime", starting with prime(n)-1.
4

%I #9 Nov 17 2013 14:52:51

%S 1,2,2,3,5,3,2,5,11,7,2,5,5,11,23,13,29,2,17,5,5,5,41,11,3,13,13,53,7,

%T 7,2,17,17,5,37,19,5,41,83,43,89,23,3,3,13,13,53,7,113,29,29,2,2,2,2,

%U 131,67,17,5,5,71,73,5,5,5,79,83,11,173,11,11,179,23,47,3,191,97,13

%N Fixed point of "k -> k/2 or (k+1)/2 until result is prime", starting with prime(n)-1.

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

%t see A039635.

%o (Haskell)

%o a039640 1 = 1

%o a039640 n = until ((== 1) . a010051) (flip div 2 . (+ 1)) (a000040 n - 1)

%o -- _Reinhard Zumkeller_, Nov 17 2013

%Y Cf. A039634-A039645.

%Y Cf. A010051, A000040, A039644, A039638, A039635.

%K nonn

%O 1,2

%A _Wouter Meeussen_

%E Offset corrected by _Reinhard Zumkeller_, Nov 17 2013