OFFSET
1,4
LINKS
Winston de Greef, Table of n, a(n) for n = 1..10000
EXAMPLE
5 -> 26 -> 13 -> 66 -> 11 -> 56 -> 28 -> 14 -> 7 -> 36 -> 6 -> 1. Thus a(5) = 11.
MAPLE
a:= proc(n) option remember; `if`(n=1, 0, 1+
a((g-> `if`(g>1, n/g, 5*n+1))(igcd(n, 6))))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Jan 19 2022
MATHEMATICA
f[n_]:=If[GCD[n, 6]>1, n/GCD[n, 6], 5*n+1]; Table[f[n], {n, 0, 100}];
S[n_]:=S[n]=Which[n==1, 0, f[n]==1, 1, True, 1+S[f[n]]];
Table[S[n], {n, 1, 86}]
PROG
(PARI)
A350034(n) = my(g = gcd(n, 6)); if (g>1, n/g, 5*n+1);
a(n)=my(r=0); while(n != 1, n = A350034(n); r+=1); r \\ Winston de Greef, Oct 02 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
José María Grau Ribas, Jan 19 2022
STATUS
approved