OFFSET
1,4
FORMULA
a(A000040(n)) = 1.
EXAMPLE
For n = 9, 1 --> 9 --> 27 --> 36 --> 81 --> 45 --> 54 --> 72 --> 108 --> 108. The cycle reached has just one term: 108. Therefore, a(9) = 1.
MATHEMATICA
a[n_] := Module[{s = NestWhileList[n * DivisorSigma[0, #] &, 1, UnsameQ, All]}, Differences[Position[s, s[[-1]]]][[1, 1]]]; Array[a, 100] (* Amiram Eldar, Nov 17 2021 *)
PROG
(Python)
from sympy import divisor_count
terms = []
for n in range(1, 101):
s, t = [1], True
while t:
for i in range(2, len(s)):
if s[-i] == s[-1]:
t = False
terms.append(i - 1)
break
s.append(n*divisor_count(s[-1]))
print(terms) # Gleb Ivanov, Nov 17 2021
(PARI) f(n, x) = n*numdiv(x);
find(nm, v) = {forstep (n=#v-1, 1, -1, if (v[#v] == v[n], return(#v-n); ); ); }
a(n) = {my(list = List(), found=0, m=n); listput(list, m); while (! found, my(nm = f(n, m)); listput(list, nm); found = find(nm, list); m = nm; ); found; } \\ Michel Marcus, Nov 17 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Tejo Vrush, Nov 16 2021
STATUS
approved