|
|
A183534
|
|
Square array of generalized Ulam numbers U(n,k), n>=1, k>=2, read by antidiagonals: U(n,k) = n if n<=k; for n>k, U(n,k) = least number > U(n-1,k) which is a unique sum of k distinct terms U(i,k) with i<n.
|
|
10
|
|
|
1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 6, 6, 1, 2, 3, 4, 9, 8, 1, 2, 3, 4, 10, 10, 11, 1, 2, 3, 4, 5, 16, 11, 13, 1, 2, 3, 4, 5, 15, 17, 12, 16, 1, 2, 3, 4, 5, 6, 25, 18, 28, 18, 1, 2, 3, 4, 5, 6, 21, 26, 19, 29, 26, 1, 2, 3, 4, 5, 6, 7, 36, 27, 22, 30, 28, 1, 2, 3, 4, 5, 6, 7, 28, 37, 28, 64, 53, 36
(list;
table;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
The columns are Ulam-type sequences - see A002858 for further information. Some of these sequences - but not all - seem to have quite simple generating functions.
U(k+1,k) = k*(k+1)/2.
U(k+2+j,k) = k^2+j for k>=3 and 0<=j<k.
U(2*k+2,k) = k*(3*k-1)/2 for k>=3.
|
|
LINKS
|
|
|
EXAMPLE
|
Square array U(n,k) begins:
1, 1, 1, 1, 1, 1, ...
2, 2, 2, 2, 2, 2, ...
3, 3, 3, 3, 3, 3, ...
4, 6, 4, 4, 4, 4, ...
6, 9, 10, 5, 5, 5, ...
8, 10, 16, 15, 6, 6, ...
|
|
MAPLE
|
b:= proc(n, i, k, h) option remember;
local t;
if n<0 or h<0 then 0
elif n=0 then `if`(h=0, 1, 0)
elif i=0 or h=0 then 0
elif h=1 then t:= v(n, k);
`if`(t>0 and t<=i, 1, 0)
else t:= b(n -U(i, k), i-1, k, h-1);
t+ `if`(t>1, 0, b(n, i-1, k, h))
fi
end:
v:= proc() 0 end:
U:= proc(n, k) option remember;
local m;
if n<=k then v(n, k):= n
else for m from U(n-1, k)+1
while b(m, n-1, k, k)<>1 do od;
v(m, k):= n; m
fi
end:
seq(seq(U(n, 2+d-n), n=1..d), d=1..12);
|
|
MATHEMATICA
|
b[n_, i_, k_, h_] := b[n, i, k, h] = Module[{t}, Which[n < 0 || h < 0, 0, n == 0, If[h == 0, 1, 0], i == 0 || h == 0, 0, h == 1, t = v[n, k]; If[t > 0 && t <= i, 1, 0], True, t = b[n-U[i, k], i-1, k, h-1]; t+If[t > 1, 0, b[n, i-1, k, h]] ] ]; v[_, _] = 0; U[n_, k_] := U[n, k] = Module[{m}, If[n <= k, v[n, k] = n, For[m = U[n-1, k]+1, b[m, n-1, k, k] != 1, m++]; v[m, k] = n; m] ]; Table[Table[U[n, 2+d-n], {n, 1, d}], {d, 1, 12}] // Flatten (* Jean-François Alcover, Dec 23 2013, translated from Maple *)
|
|
PROG
|
(PARI)
Ulam(N, k=2, v=0)={ my( a=vector(k, i, i), c );
for( n=k, N-1, for( t=1+a[n], 9e9, c=0;
forvec(v=vector(k, i, [i, n]), sum(j=1, k, a[v[j]])==t & c++>1 & next(2), 2);
c|next; v&print1(t", "); a=concat(a, t); break;
)); a}
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|