OFFSET
2,3
COMMENTS
In other words: start with (i1=n,i2=n), go up from i2 to the next number coprime to i1. Let this be the new i2. Then go down from i1 to the next number coprime to i2. Let this be the new i1. Then a(n) is the number of these steps needed to reach i1 = 1.
Obviously, a(n) < n.
EXAMPLE
Example: (6,6)->(5,7)->(3,8)->(1,10), so a(6) = 3.
(7,7)->(5,8)->(4,9)->(3,11)->(2,13)->(1,15), a(7) = 5.
PROG
(PARI) for(n=2, 100, count=0:left=n:right=n:c=n:g=n:f=1:while(g>1, count=count+1:while(gcd(g, c)>1, c=c+f):g=c: if(f<0, left=c:c=right+1, right=c:c=left-1):f=-f):print1(count/2", "))
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Jun 02 2003
EXTENSIONS
Edited by Ralf Stephan, Jun 27 2003
STATUS
approved