OFFSET
1,2
LINKS
Stefano Spezia, First 150 rows of the triangle, flattened
FORMULA
T(n, k) = floor(n/k)*10^(1+floor(log10(n mod k))) + (n mod k) if n is not divisible by k.
T(n, n) = 1.
T(n, 1) = n.
T(n, k) = 2*T(n-k, k) - T(n-2*k, k) for n >= 3*k.
T(n, k) = [x^n] x^k*(1 + (Sum_{i=1..k-1} (i + 10^(1+floor(log10(n mod k))))*x^i) - (Sum_{i=1..k-1} i*x^(k+i)))/(1 - x^k)^2.
EXAMPLE
The triangle begins:
1;
2, 1;
3, 11, 1;
4, 2, 11, 1;
5, 21, 12, 11, 1;
6, 3, 2, 12, 11, 1;
7, 31, 21, 13, 12, 11, 1;
...
MATHEMATICA
T[n_, k_]:=If[Divisible[n, k], n/k, FromDigits[Join[IntegerDigits[Floor[n/k]], IntegerDigits[Mod[n, k]]]]]; Table[T[n, k], {n, 12}, {k, n}]//Flatten (* or *)
T[n_, k_]:=Floor[n/k]10^IntegerLength[Mod[n, k]]+Mod[n, k]; Table[T[n, k], {n, 12}, {k, n}]//Flatten (* or *)
T[n_, k_]:=SeriesCoefficient[x^k(1+Sum[(i + 10^(1+Floor[Log10[Mod[n, k]]]))*x^i, {i, k-1}] - Sum[i*x^(k+i), {i, k-1}])/(1-x^k)^2, {x, 0, n}]; Table[T[n, k], {n, 12}, {k, n}]//Flatten
CROSSREFS
AUTHOR
Stefano Spezia, May 04 2024
STATUS
approved