OFFSET
1,3
COMMENTS
Conjecture: a(n) is never equal to -1.
EXAMPLE
Irregular array n\ iterations gpf(3n+1):
1: 2, so a(1) = 1.
2: already 2, so a(2) = 0.
3: 5, 2, so a(3) = 2.
4: 13, 5, 2, so a(4) = 3.
5: 2, so a(5) = 1.
6: 19, 29, 11, 17, 13, 5, 2, so a(6) = 7.
7: 11, 17, 13, 5, 2, so a(7) = 5.
8: 5, 2, so a(8) = 2.
9: 7, 11, 17, 13, 5, 2, so a(9) = 6.
10: 31, 47, 71, 107, 23, 7, 11, 17, 13, 5, 2, so a(10) = 11.
11: 17, 13, 5, 2, so a(11) = 4.
12: 37, 7, 11, 17, 13, 5, 2, so a(12) = 7.
13: 5, 2, so a(13) = 2.
14: 43, 13, 5, 2, so a(14) = 4.
15: 23, 7, 11, 17, 13, 5, 2, so a(15) = 7.
MAPLE
a:= proc(n) option remember;
`if`(n=2, 0, a(max(ifactors(3*n+1)[2][.., 1]))+1)
end:
seq(a(n), n=1..83); # Alois P. Heinz, Nov 26 2025
MATHEMATICA
a[n_] := -1 + Length@ NestWhileList[FactorInteger[3*# + 1][[-1, 1]] &, n, # != 2 &]; Array[a, 100] (* Amiram Eldar, Nov 26 2025 *)
PROG
(PARI) a(n) = my(nb=0); while(n!=2, nb++; n=vecmax(factor(3*n+1)[, 1])); nb;
(Python)
from sympy import factorint
from functools import cache
@cache
def a(n): return 0 if n == 2 else 1 + a(max(factorint(3*n+1)))
print([a(n) for n in range(1, 84)]) # Michael S. Branicky, Dec 04 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Alain Rocchelli, Nov 26 2025
STATUS
approved
