OFFSET
1,3
COMMENTS
n=333 is the smallest n>1 with a(n)=0.
LINKS
Michel Marcus, Table of n, a(n) for n = 1..10000
EXAMPLE
For n=6, we get 6/1 -> 5/3 -> 2/3 -> 1/1 so a(6)=1.
For n=333, we get 333/1 -> 332/13 -> 319/83 -> 236/797 -> 561/59 -> 502/701 -> 199/251 -> 52/497 -> 445/13 -> 432/139 -> 293/27 -> 266/183 -> 83/133 -> 50/207 -> 157/25 -> 132/49 -> 83/33 -> 50/207 so a(333)=0.
PROG
(PARI) h(n) = if (n%2, 5*n-1, n/2);
g(n) = {n = h(n); while (!(n%2), n = h(n)); n; }
f(n) = {my(p = numerator(n), q = denominator(n)); abs(p-q)/g(p); }
a(n) = {my(v = []); for (k=1, oo, n = f(n); if (denominator(n) == 1, return(n)); if (#select(x->(x==n), v) > 0, return(0)); v = concat(v, n); ); } \\ Michel Marcus, Mar 23 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Floor van Lamoen, Jul 12 2001
STATUS
approved