OFFSET
1,5
COMMENTS
Each column is periodic: T(n+A003418(k),k) = T(n,k). - Robert Israel, Feb 02 2016
LINKS
Peter Kagey, Table of n, a(n) for n = 1..10000
"ModernModest", Reddit discussion
EXAMPLE
T(5, 3) = 3 because the algorithm requires three steps to reach 0.
5 % 3 = 2
5 % 2 = 1
5 % 1 = 0
Triangle begins:
1
1 1
1 2 1
1 1 2 1
1 2 3 2 1
1 1 1 2 2 1
1 2 2 3 3 2 1
1 1 2 1 3 2 2 1
1 2 1 2 3 2 3 2 1
1 1 2 2 1 3 3 2 2 1
1 2 3 4 2 3 5 4 3 2 1
1 1 1 1 2 1 3 2 2 2 2 1
MAPLE
T:= proc(n, k) option remember; local m;
if k = 0 then 0 else 1 + procname(n, n mod k) fi
end proc:
seq(seq(T(n, k), k=1..n), n=1..30); # Robert Israel, Feb 02 2016
MATHEMATICA
T[n_, k_] := T[n, k] = If[k == 0, 0, 1 + T[n, Mod[n, k]]];
Table[Table[T[n, k], {k, 1, n}], {n, 1, 30}] // Flatten (* Jean-François Alcover, Jan 31 2023, after Robert Israel *)
CROSSREFS
KEYWORD
tabl,nonn
AUTHOR
Peter Kagey, Jan 25 2016
STATUS
approved