OFFSET
1,11
COMMENTS
Subtraction terminates when the remainder is less than the smallest nonzero proper suffix of n. A suffix of n is n mod 10^k for some k and a proper suffix is one that is strictly less than n. Equivalently, a proper suffix of n is the decimal value of the digits of n with one or more leading digits removed.
EXAMPLE
a(131) = 11 since 131-31-31-31-31-1-1-1-1-1-1-1 = 0 has 11 subtractions;
a(132) = 6 since 132-32-32-32-32-2-2 = 0 has 6 subtractions;
a(133) = 4 since 133-33-33-33-33 = 1 has 4 subtractions.
MATHEMATICA
count = 1000; SubCount = {};
Do[(n = m = k; c = 0;
While[n > 0,
If[n <= m, m = ToExpression[StringDrop[ToString[k], 1]], m];
If[m == Null || m == 0, Break[]]; n -= m;
If[n < 0, Break[]]; c++;
]; AppendTo[SubCount, c]; ), {k, 1, count, 1}];
ListPlot[SubCount]
Print[SubCount];
PROG
(PARI) a(n)={my(m=n%(10^logint(n, 10)), s=0); while(m>0, s+=n\m; n%=m; m%=10^logint(m, 10)); s} \\ Andrew Howroyd, Nov 21 2020
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Linus Jarbo and Hugo Angulo, Nov 15 2020
STATUS
approved