|
|
A291896
|
|
Number of 1-dimensional sandpiles with n grains piling up against the wall.
|
|
7
|
|
|
1, 1, 1, 2, 3, 5, 9, 14, 24, 40, 67, 112, 186, 312, 520, 868, 1449, 2417, 4034, 6730, 11229, 18735, 31254, 52143, 86989, 145119, 242096, 403871, 673751, 1123964, 1875014, 3127926, 5218034, 8704769, 14521354, 24224601, 40411595, 67414781, 112461579, 187608762
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
COMMENTS
|
Number of compositions of n where the first part is 1 and the absolute difference between consecutive parts is <=1 (smooth compositions).
|
|
LINKS
|
|
|
EXAMPLE
|
The a(6)=9 smooth compositions of 6 are:
:
: oooooo|
:
: o|
: ooooo|
:
: o |
: ooooo|
:
: o |
: ooooo|
:
: o |
: ooooo|
:
: oo|
: oooo|
:
: o o|
: oooo|
:
: oo |
: oooo|
:
: o|
: oo|
: ooo|
|
|
MAPLE
|
b:= proc(n, i) option remember; `if`(n=0, 1,
add(b(n-j, j), j=max(1, i-1)..min(i+1, n)))
end:
a:= n-> b(n, 0):
|
|
MATHEMATICA
|
b[n_, i_] := b[n, i] = If[n==0, 1, Sum[b[n-j, j], {j, Max[1, i-1], Min[i+1, n]}]]; a[n_] := b[n, 0]; Table[a[n], {n, 0, 50}] (* Jean-François Alcover, May 29 2019, after Alois P. Heinz *)
|
|
PROG
|
(Python)
from sympy.core.cache import cacheit
@cacheit
def b(n, i): return 1 if n==0 else sum(b(n - j, j) for j in range(max(1, i - 1), min(i + 1, n) + 1))
def a(n): return b(n, 0)
print([a(n) for n in range(51)]) # Indranil Ghosh, Sep 06 2017, after Maple code
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|