OFFSET
1,2
MATHEMATICA
gradus[n_] := 1 + Plus @@ ((First[#] - 1) * Last[#] & /@ FactorInteger[n]); a[n_] := FixedPoint[gradus, n]; Array[a, 100] (* Amiram Eldar, Nov 11 2019 *)
PROG
(Python)
from gmpy2 import is_prime
from sympy import factorint
def gradus(n):
sum = 0
factors = factorint(n)
for p, a in factors.items():
sum += (p - 1)*a
return sum + 1
if __name__ == "__main__":
glist = []
for x in range(1, 80):
glist.append(gradus(x))
while True:
for p in glist:
a = 0
if not is_prime(p):
glist = [gradus(x) for x in glist]
a = 1
if a == 0:
break
print(', '.join([str(x) for x in glist]))
(PARI) g(n) = my (f=factor(n)); 1+sum(k=1, #f~, f[k, 2]*(f[k, 1]-1))
a(n) = while (n!=n=g(n), ); n \\ Rémy Sigrist, Dec 03 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Daniel Hoyt, Nov 11 2019
STATUS
approved