

A121480


Take b(0)=n, for i>0 if b(i1) is odd prime then b(i)=(b(i1)+1)/2 otherwise b(i)=b(i1)+1. For all n sequence b(i) ends with 2. The sequence gives a(n) = a number of steps from n to 2, a(n)=i when b(i)=2.


0



2, 1, 0, 1, 3, 2, 5, 4, 9, 8, 7, 6, 6, 5, 12, 11, 10, 9, 9, 8, 10, 9, 8, 7, 17, 16, 15, 14, 13, 12, 12, 11, 14, 13, 12, 11, 10, 9, 13, 12, 11, 10, 10, 9, 21, 20, 19, 18, 20, 19, 18, 17, 16, 15, 18, 17, 16, 15, 14, 13, 13, 12, 18, 17, 16, 15, 14, 13, 14, 13, 12, 11, 11, 10, 17, 16, 15
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,1


LINKS



EXAMPLE

a(8)=9 because b(0)=8, b(1)=9, b(2)=10, 11, 6, 7, 4, 5, 3, b(9)=2;
a(10)=7 because b(0)=10, b(1)=11, 6, 7, 4, 5, 3, b(7)=2, etc


MATHEMATICA

b=c=1; re={{0, 2}, {1, 1}, {2, 0}}; Do[i=0; a=n; While[a!=2, i++; If[PrimeQ[a], a=(a+c)/2, a=a+b]]; AppendTo[re, i], {n, 3, 100}]; re


CROSSREFS



KEYWORD

nonn


AUTHOR



STATUS

approved



