cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A238870 #29 Mar 11 2022 07:48:16
%S A238870 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 A238870 399,536,772,1013,1373,1938,2574,3503,4882,6540,8918,12329,16611,
%U A238870 22672,31183,42182,57588,78952,107092,146202,200037,271831,371057,507053,689885,941558,1285655,1750672,2388951,3260459,4442179,6060948
%N A238870 Number of compositions of n with c(1) = 1, c(i+1) - c(i) <= 1, and c(i+1) - c(i) != 0.
%C A238870 Number of fountains of n coins with at most two successive coins on the same level.
%H A238870 Joerg Arndt and Alois P. Heinz, <a href="/A238870/b238870.txt">Table of n, a(n) for n = 0..1000</a>
%F A238870 a(n) ~ c / r^n, where r = 0.733216317061133379740342579187365700397652443391231594... and c = 0.172010618097928709454463097802313209201440229976513439... . - _Vaclav Kotesovec_, Feb 17 2017
%e A238870 The a(10) = 4 such compositions are:
%e A238870 :
%e A238870 :   1:  [ 1 2 1 2 1 2 1 ]  (composition)
%e A238870 :
%e A238870 :  o o o
%e A238870 : ooooooo   (rendering as composition)
%e A238870 :
%e A238870 :     O   O   O
%e A238870 :    O O O O O O O  (rendering as fountain of coins)
%e A238870 :
%e A238870 :
%e A238870 :   2:  [ 1 2 1 2 3 1 ]
%e A238870 :
%e A238870 :     o
%e A238870 :  o oo
%e A238870 : oooooo
%e A238870 :
%e A238870 :           O
%e A238870 :      O   O O
%e A238870 :     O O O O O O
%e A238870 :
%e A238870 :
%e A238870 :   3:  [ 1 2 3 1 2 1 ]
%e A238870 :
%e A238870 :   o
%e A238870 :  oo o
%e A238870 : oooooo
%e A238870 :
%e A238870 :       O
%e A238870 :      O O   O
%e A238870 :     O O O O O O
%e A238870 :
%e A238870 :
%e A238870 :   4:  [ 1 2 3 4 ]
%e A238870 :
%e A238870 :    o
%e A238870 :   oo
%e A238870 :  ooo
%e A238870 : oooo
%e A238870 :
%e A238870 :         O
%e A238870 :        O O
%e A238870 :       O O O
%e A238870 :      O O O O
%e A238870 :
%p A238870 b:= proc(n, i) option remember; `if`(n=0, 1, add(
%p A238870       `if`(i=j, 0, b(n-j, j)), j=1..min(n, i+1)))
%p A238870     end:
%p A238870 a:= n-> b(n, 0):
%p A238870 seq(a(n), n=0..60);  # _Alois P. Heinz_, Mar 11 2014
%t A238870 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 A238870 a[n_] := b[n, 0];
%t A238870 a /@ Range[0, 60] (* _Jean-François Alcover_, Nov 07 2020, after _Alois P. Heinz_ *)
%o A238870 (Sage) # translation of the Maple program by _Alois P. Heinz_
%o A238870 @CachedFunction
%o A238870 def F(n, i):
%o A238870     if n == 0: return 1
%o A238870     return sum( (i!=j) * F(n-j, j) for j in [1..min(n,i+1)] ) # A238870
%o A238870 #    return sum( F(n-j, j) for j in [1, min(n,i+1)] ) # A005169
%o A238870 def a(n): return F(n, 0)
%o A238870 print([a(n) for n in [0..50]])
%o A238870 # _Joerg Arndt_, Mar 20 2014
%Y A238870 Cf. A005169 (fountains of coins), A001524 (weakly unimodal fountains of coins).
%Y A238870 Cf. A186085 (1-dimensional sandpiles), A227310 (rough sandpiles).
%Y A238870 Cf. A023361 (fountains of coins with all valleys at lowest level).
%K A238870 nonn
%O A238870 0,7
%A A238870 _Joerg Arndt_, Mar 09 2014