OFFSET
1,2
COMMENTS
MATHEMATICA
With[{s = Array[-1 + Length@ NestWhileList[Which[EvenQ@ #, #/2, PrimeQ@ #, #^2 - 1, True, # - 1] &, #, # > 1 &] &, 396]}, Map[FirstPosition[s, #][[1]] &, Union@ FoldList[Max, s]]] (* Michael De Vlieger, Feb 12 2021 *)
PROG
(Python)
from sympy import isprime
rec = -1
for n in range(1, 397):
m, ct = n, 0
while m > 1:
if m%2 == 0: m /= 2
elif isprime(m) == 1: m = m*m - 1
else: m -= 1
ct += 1
if ct > rec: print(n); rec = ct
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Ya-Ping Lu, Jan 06 2021
STATUS
approved