OFFSET
2,1
COMMENTS
See A057684 for definition.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 2..10001 (terms 2..1000 from T. D. Noe)
EXAMPLE
For n=3, P=7: trajectory of 7 is 7, 50, 25, 5, 1, 8, 4, 2, 1, 8, 4, 2, 1, 8, 4, 2, 1, ..., which has maximal term 50, cycle length 4 and there are 4 terms before it enters the cycle.
MATHEMATICA
Px1[p_, n_]:=Catch[For[i=1, i<PrimePi[p], i++, If[Divisible[n, Prime[i]], Throw[n/Prime[i]]]]; p*n+1];
Module[{nmax=100, m}, Table[FirstPosition[m=NestWhileList[Px1[Prime[n], #]&, Prime[n], UnsameQ, All], Last[m]][[1]]-1, {n, 2, nmax}]] (* Paolo Xausa, Dec 11 2023 *)
PROG
(Python)
from sympy import prime, primerange
def a(n):
P = prime(n)
x, plst, traj, seen = P, list(primerange(2, P)), [], set()
while x not in seen:
traj.append(x)
seen.add(x)
x = next((x//p for p in plst if x%p == 0), P*x+1)
return traj.index(x)
print([a(n) for n in range(2, 82)]) # Michael S. Branicky, Dec 11 2023
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
N. J. A. Sloane, Oct 20 2000
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Nov 08 2000
STATUS
approved