login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A238870 Number of compositions of n with c(1) = 1, c(i+1) - c(i) <= 1, and c(i+1) - c(i) != 0. 3

%I #29 Mar 11 2022 07:48:16

%S 1,1,0,1,1,0,2,2,1,4,4,4,9,10,11,21,25,30,51,62,80,125,157,208,309,

%T 399,536,772,1013,1373,1938,2574,3503,4882,6540,8918,12329,16611,

%U 22672,31183,42182,57588,78952,107092,146202,200037,271831,371057,507053,689885,941558,1285655,1750672,2388951,3260459,4442179,6060948

%N Number of compositions of n with c(1) = 1, c(i+1) - c(i) <= 1, and c(i+1) - c(i) != 0.

%C Number of fountains of n coins with at most two successive coins on the same level.

%H Joerg Arndt and Alois P. Heinz, <a href="/A238870/b238870.txt">Table of n, a(n) for n = 0..1000</a>

%F a(n) ~ c / r^n, where r = 0.733216317061133379740342579187365700397652443391231594... and c = 0.172010618097928709454463097802313209201440229976513439... . - _Vaclav Kotesovec_, Feb 17 2017

%e The a(10) = 4 such compositions are:

%e :

%e : 1: [ 1 2 1 2 1 2 1 ] (composition)

%e :

%e : o o o

%e : ooooooo (rendering as composition)

%e :

%e : O O O

%e : O O O O O O O (rendering as fountain of coins)

%e :

%e :

%e : 2: [ 1 2 1 2 3 1 ]

%e :

%e : o

%e : o oo

%e : oooooo

%e :

%e : O

%e : O O O

%e : O O O O O O

%e :

%e :

%e : 3: [ 1 2 3 1 2 1 ]

%e :

%e : o

%e : oo o

%e : oooooo

%e :

%e : O

%e : O O O

%e : O O O O O O

%e :

%e :

%e : 4: [ 1 2 3 4 ]

%e :

%e : o

%e : oo

%e : ooo

%e : oooo

%e :

%e : O

%e : O O

%e : O O O

%e : O O O O

%e :

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

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

%p end:

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

%p seq(a(n), n=0..60); # _Alois P. Heinz_, Mar 11 2014

%t b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[If[i == j, 0, b[n-j, j]], {j, 1, Min[n, i+1]}]];

%t a[n_] := b[n, 0];

%t a /@ Range[0, 60] (* _Jean-François Alcover_, Nov 07 2020, after _Alois P. Heinz_ *)

%o (Sage) # translation of the Maple program by _Alois P. Heinz_

%o @CachedFunction

%o def F(n, i):

%o if n == 0: return 1

%o return sum( (i!=j) * F(n-j, j) for j in [1..min(n,i+1)] ) # A238870

%o # return sum( F(n-j, j) for j in [1, min(n,i+1)] ) # A005169

%o def a(n): return F(n, 0)

%o print([a(n) for n in [0..50]])

%o # _Joerg Arndt_, Mar 20 2014

%Y Cf. A005169 (fountains of coins), A001524 (weakly unimodal fountains of coins).

%Y Cf. A186085 (1-dimensional sandpiles), A227310 (rough sandpiles).

%Y Cf. A023361 (fountains of coins with all valleys at lowest level).

%K nonn

%O 0,7

%A _Joerg Arndt_, Mar 09 2014

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 29 10:22 EDT 2024. Contains 371268 sequences. (Running on oeis4.)