OFFSET
1,8
COMMENTS
If n is prime, or n is in A164643, then a(n) = 1.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(12) = 3 because 12 mod (2+2+3) = 5, 12 mod 5 = 2 and 12 mod 2 = 0 (3 iterations).
a(54) = 5 because 54 mod (2+3+3+3) = 10, 54 mod (2+5) = 6, 54 mod 5 = 4, 54 mod (2+2) = 2, and 54 mod 2 = 0 (5 iterations).
MAPLE
sopfr:= proc(n) local t;
add(t[1]*t[2], t = ifactors(n)[2])
end proc:
f:= proc(n) local x, k;
x:= n;
for k from 1 do x:= n mod sopfr(x); if x <= 1 then return k fi od;
end proc:
f(1):= 0:
map(f, [$1..200]);
PROG
(Python)
from sympy import factorint
def A340967(n):
c, x = 0, n
while x > 1:
c += 1
x = n % sum(p*e for p, e in factorint(x).items())
return c # Chai Wah Wu, Feb 01 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Jan 31 2021
STATUS
approved