%I #14 Aug 22 2020 17:43:03
%S 0,1,1,1,1,2,1,2,2,3,1,3,1,4,3,1,1,2,1,2,2,4,1,2,2,4,1,3,1,1,1,2,3,4,
%T 4,2,1,4,4,3,1,2,1,3,2,4,1,2,2,2,5,2,1,4,4,2,5,4,1,1,1,4,4,2,4,2,1,4,
%U 3,1,1,1,1,4,3,4,4,2,1,2,2,4,1,1,5,4,6,3,1,3,4,3,4,4,5,3,1,2,3
%N Starting at k = A001414(n), iterate k -> n mod k until k=0. a(n) is the number of steps taken.
%C If n is prime, a(n)=1.
%H Robert Israel, <a href="/A329656/b329656.txt">Table of n, a(n) for n = 1..10000</a>
%e A001414(6) = 2+3 = 5, 6 mod 5 = 1, 6 mod 1 = 0 so a(6) = 2.
%p f:= proc(n) local s, t;
%p s:= convert(map(convert,ifactors(n)[2],`*`),`+`);
%p for t from 1 do
%p s:= n mod s;
%p if s = 0 then return t fi
%p od
%p end proc:
%p f(1):= 0:
%p map(f, [$1..200]);
%t sopfr[n_] := If[n == 1, 0, Total[Times @@@ FactorInteger[n]]];
%t f[n_] := Module[{s, t}, s = sopfr[n]; For[t = 1, True, t++, s = Mod[n, s]; If[s == 0, Return [t]]]]; f[1] = 0;
%t Array[f, 200] (* _Jean-François Alcover_, Aug 22 2020, after Maple *)
%Y Cf. A001414.
%K nonn
%O 1,6
%A _J. M. Bergot_ and _Robert Israel_, Nov 18 2019
|