|
|
A221235
|
|
Number of nonnegative integer arrays of length n summing to n without adjacent equal values.
|
|
3
|
|
|
1, 1, 2, 7, 14, 30, 76, 188, 444, 1075, 2656, 6504, 15926, 39316, 97252, 240597, 596686, 1482971, 3689768, 9191590, 22927718, 57253334, 143101896, 358003469, 896391914, 2246149936, 5632310800, 14132640565, 35483595966, 89141668532, 224061612932, 563473301874
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
All solutions for n=3
..1....2....0....2....0....0....1
..2....1....3....0....2....1....0
..0....0....0....1....1....2....2
|
|
MAPLE
|
b:= proc(n, h, t) option remember; `if`(t<2, `if`(n<>h, 1, 0),
add(`if`(h=j, 0, b(n-j, `if`(j>n-j, -1, j), t-1)), j=0..n))
end:
a:= n-> b(n, -1, n):
|
|
MATHEMATICA
|
b[n_, h_, t_] := b[n, h, t] = If[t < 2, If[n != h, 1, 0],
Sum[If[h == j, 0, b[n-j, If[j > n-j, -1, j], t-1]], {j, 0, n}]];
a[n_] := b[n, -1, n];
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|