This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A340967 #16 Feb 01 2021 13:28:13 %S A340967 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, %T A340967 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, %U A340967 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 %N 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. %C A340967 If n is prime, or n is in A164643, then a(n) = 1. %H A340967 Robert Israel, <a href="/A340967/b340967.txt">Table of n, a(n) for n = 1..10000</a> %e A340967 a(12) = 3 because 12 mod (2+2+3) = 5, 12 mod 5 = 2 and 12 mod 2 = 0 (3 iterations). %e A340967 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). %p A340967 sopfr:= proc(n) local t; %p A340967 add(t[1]*t[2], t = ifactors(n)[2]) %p A340967 end proc: %p A340967 f:= proc(n) local x,k; %p A340967 x:= n; %p A340967 for k from 1 do x:= n mod sopfr(x); if x <= 1 then return k fi od; %p A340967 end proc: %p A340967 f(1):= 0: %p A340967 map(f, [$1..200]); %o A340967 (Python) %o A340967 from sympy import factorint %o A340967 def A340967(n): %o A340967 c, x = 0, n %o A340967 while x > 1: %o A340967 c += 1 %o A340967 x = n % sum(p*e for p, e in factorint(x).items()) %o A340967 return c # _Chai Wah Wu_, Feb 01 2021 %Y A340967 Cf. A001414, A164643, A340969. %K A340967 nonn %O A340967 1,8 %A A340967 _J. M. Bergot_ and _Robert Israel_, Jan 31 2021