login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A340967
a(n) is the number of iterations of the map x -> n mod sopfr(x) starting with n to reach 0 or 1, where sopfr = A001414.
2
0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 3, 1, 4, 2, 1, 1, 2, 1, 2, 1, 4, 1, 3, 2, 4, 1, 3, 1, 1, 1, 2, 3, 3, 3, 2, 1, 4, 4, 3, 1, 3, 1, 4, 1, 3, 1, 2, 2, 2, 4, 1, 1, 5, 3, 2, 4, 4, 1, 1, 1, 4, 4, 2, 4, 2, 1, 4, 2, 1, 1, 1, 1, 3, 3, 3, 3, 3, 1, 2, 3, 3, 1, 1, 3, 4, 5, 2, 1, 3, 3, 3, 3, 5, 4, 2, 1, 2, 2
OFFSET
1,8
COMMENTS
If n is prime, or n is in A164643, then a(n) = 1.
LINKS
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