login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A034297 Number of ordered positive integer solutions (m_1, m_2, ..., m_k) (for some k) to Sum_{i=1..k} m_i=n with |m_i-m_{i-1}| <= 1 for i = 2 ... k. 9
1, 2, 4, 6, 11, 17, 29, 47, 78, 130, 215, 357, 595, 990, 1651, 2748, 4584, 7643, 12744, 21256, 35451, 59133, 98636, 164531, 274463, 457837, 763746, 1274060, 2125356, 3545491, 5914545, 9866602, 16459421, 27457549, 45804648, 76411272, 127469285, 212644336 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Compositions of n where successive parts differ by at most 1, see example. [Joerg Arndt, Dec 10 2012]

LINKS

Alois P. Heinz, Table of n, a(n) for n = 1..1000

FORMULA

a(n) ~ c * d^n, where d = 1.668202067018461116361070469945501401879811945303435230637248..., c = 0.762436680050402638439806786781869262562176911054246754543346... . - Vaclav Kotesovec, Sep 02 2014

EXAMPLE

From Joerg Arndt, Dec 10 2012: (Start)

The a(6) = 17 such compositions of 6 are

[ #]     composition

[ 1]    [ 1 1 1 1 1 1 ]

[ 2]    [ 1 1 1 1 2 ]

[ 3]    [ 1 1 1 2 1 ]

[ 4]    [ 1 1 2 1 1 ]

[ 5]    [ 1 1 2 2 ]

[ 6]    [ 1 2 1 1 1 ]

[ 7]    [ 1 2 1 2 ]

[ 8]    [ 1 2 2 1 ]

[ 9]    [ 1 2 3 ]

[10]    [ 2 1 1 1 1 ]

[11]    [ 2 1 1 2 ]

[12]    [ 2 1 2 1 ]

[13]    [ 2 2 1 1 ]

[14]    [ 2 2 2 ]

[15]    [ 3 2 1 ]

[16]    [ 3 3 ]

[17]    [ 6 ]

(End)

MAPLE

b:= proc(n, i) option remember;

      `if`(n=i, 1, `if`(n<0 or i<1, 0, add(b(n-i, i+j), j=-1..1)))

    end:

a:= n-> add(b(n, k), k=1..n):

seq(a(n), n=1..50);  # Alois P. Heinz, Jul 06 2012

MATHEMATICA

b[n_, i_] := b[n, i] = If[n == i, 1, If[n<0 || i<1, 0, Sum[b[n-i, i+j], {j, -1, 1}] ]]; a[n_] := Sum[b[n, k], {k, 1, n}]; Array[a, 50] (* Jean-Fran├žois Alcover, Mar 13 2015, after Alois P. Heinz *)

PROG

(PARI)

N=70;  nil=-1;

T = matrix(N, N, i, j, nil);

doIt(last, left) = my(c); c = T[last, left]; if (c == nil, c = 0; for (i = max(1, last - 1), last + 1, c += b(i, left - i)); T[last, left] = c); c;

b(last, left) = if (left == 0, return(1)); if (left < 0, return(0)); doIt(last, left);

a(n) = sum (i = 1, n, b(i, n - i));

vector(N, n, a(n))  \\ David Wasserman

CROSSREFS

Cf. A003116, A034296.

Column k=1 of A214246, A214248.

Sequence in context: A115315 A004698 A014217 * A026636 A026658 A138688

Adjacent sequences:  A034294 A034295 A034296 * A034298 A034299 A034300

KEYWORD

nonn

AUTHOR

Erich Friedman

EXTENSIONS

More terms from David Wasserman, Feb 02 2006

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 | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified April 24 00:59 EDT 2017. Contains 285338 sequences.