OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10011 (first 141 rows, flattened; first 40 rows from T. D. Noe)
EXAMPLE
Triangle starts
1
2 11
3 12 21
4 13 22 31
5 14 23 32 41
MAPLE
f:= proc(n) local Res, d, v, count;
Res:= NULL; count:= 0;
for d from ceil(n/9) while count < n do
v:= g(n, d, n-count, 1);
Res:= Res, op(v);
count:= count + nops(v);
od:
Res
end proc:
g:= proc(n, d, remain) local rem, Res, j, j0, v;
if remain = 0 then return [] else rem:= remain fi;
if nargs = 4 then j0:= 1 else j0:= 0 fi;
if d = 1 then if n >= j0 and n <= 9 then [n] else [] fi
else
Res:= NULL;
for j from max(j0, ceil(n-9*(d-1))) to min(9, n) while rem > 0 do
v:= map(t -> j*10^(d-1)+t, procname(n-j, d-1, rem));
Res:= Res, op(v);
rem:= rem - nops(v);
od;
[Res]
fi
end proc:
for i from 1 to 25 do f(i) od; # Robert Israel, Feb 19 2018
MATHEMATICA
Needs["Combinatorica`"]; Table[Take[Union[Flatten[Table[FromDigits /@ Permutations[PadRight[s, 6]], {s, Partitions[n, 9]}]]], n], {n, 40}] (* T. D. Noe, Mar 08 2013 *)
CROSSREFS
AUTHOR
Amarnath Murthy, Apr 01 2003
STATUS
approved