login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A291905 Row sums of A291904. 5
1, 1, 0, 1, 1, 0, 2, 1, 1, 3, 2, 3, 4, 4, 6, 8, 8, 11, 14, 16, 21, 26, 32, 39, 49, 60, 75, 93, 114, 142, 176, 217, 268, 334, 411, 510, 632, 779, 967, 1196, 1477, 1832, 2266, 2801, 3470, 4291, 5310, 6572, 8129, 10061, 12449, 15401, 19058, 23581, 29178, 36102, 44668 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,7

COMMENTS

Number of compositions of n where the first part is 1 and the absolute difference between consecutive parts is 1.

LINKS

Seiichi Manyama, Table of n, a(n) for n = 0..10000

EXAMPLE

The a(6)=2 compositions of 6 are:

:

:  o o|

: oooo|

:

:   o|

:  oo|

: ooo|

:

The a(9)=3 compositions of 9 are:

:

:   o  |

:  ooo |

: ooooo|

:

:  o o o|

: oooooo|

:

:     o|

:  o oo|

: ooooo|

MAPLE

b:= proc(n, i) option remember; `if`(n=0, 1, add(

     `if`(j=i, 0, b(n-j, j)), j=max(1, i-1)..min(i+1, n)))

    end:

a:= n-> b(n, 0):

seq(a(n), n=0..60);  # Alois P. Heinz, Sep 05 2017

MATHEMATICA

T[0, 0] = 1; T[_, 0] = 0; T[n_?Positive, k_] /; 0 < k <= Floor[(Sqrt[8n+1] - 1)/2] := T[n, k] = T[n-k, k-1] + T[n-k, k+1]; T[_, _] = 0;

a[n_] := Sum[T[n, k], {k, 0, Floor[(Sqrt[8n+1] - 1)/2]}];

Table[a[n], {n, 0, 60}] (* Jean-Fran├žois Alcover, May 29 2019 *)

PROG

(Python)

from sympy.core.cache import cacheit

@cacheit

def b(n, i): return 1 if n==0 else sum([0 if j==i else 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(map(a, range(61))) # Indranil Ghosh, Sep 06 2017, after Maple program

CROSSREFS

Cf. A291896, A291904.

Sequence in context: A291874 A049346 A227310 * A240853 A319849 A117334

Adjacent sequences:  A291902 A291903 A291904 * A291906 A291907 A291908

KEYWORD

nonn

AUTHOR

Seiichi Manyama, Sep 05 2017

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 29 11:16 EST 2020. Contains 331337 sequences. (Running on oeis4.)