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.

Showing 1-10 of 15 results. Next

A034296 Number of flat partitions of n: partitions {a_i} with each |a_i - a_{i-1}| <= 1.

Original entry on oeis.org

1, 1, 2, 3, 4, 5, 7, 8, 10, 13, 15, 18, 23, 26, 31, 39, 44, 52, 63, 72, 85, 101, 115, 134, 158, 181, 208, 243, 277, 318, 369, 418, 478, 549, 622, 710, 809, 914, 1036, 1177, 1328, 1498, 1695, 1904, 2143, 2416, 2706, 3036, 3408, 3811, 4264, 4769, 5319, 5934, 6621
Offset: 0

Views

Author

Keywords

Comments

Also number of partitions of n such that all parts, with the possible exception of the largest, appear only once. Example: a(6)=7 because we have [6], [5,1], [4,2], [3,3], [3,2,1], [2,2,2] and [1,1,1,1,1,1] ([4,1,1], [3,1,1,1], [2,2,1,1], [2,1,1,1,1,1] do not qualify). - Emeric Deutsch and Vladeta Jovovic, Feb 23 2006
Also the number of partitions p of n such that d(p) > max(p) - min(p), where d is the number of distinct parts of p; indeed that inequality occurs only when d(p) = 1+ max(p) - min(p), so p satisfies a(i) - a(i-1) = 1 for all parts, ordered as a(i) >= a(i-1) > ... > a(k). - Clark Kimberling, Apr 18 2014
Flat partitions are also called gap-free partitions. See, for example, the Grabner et al. reference. - Emeric Deutsch, Sep 22 2016
Conjecture: Also the sum of the smallest parts in the distinct partitions of n with an odd number of parts. - George Beck, May 06 2017
Above conjecture was proved by Shane Chern, see link. - George Beck, Aug 12 2017
Note that Andrews [2016] uses a(0) = 1. - Michael Somos, Aug 07 2017
Also called number of compact partitions of n where a compact partition is one where every integer between the largest and smallest parts of it also appears as a part. [Andrews 2016] - Michael Somos, Aug 13 2017

Examples

			From _Joerg Arndt_, Dec 27 2012: (Start)
The a(11)=18 flat partitions of 11 are (in lexicographic order)
[ 1]  [ 1 1 1 1 1 1 1 1 1 1 1 ]
[ 2]  [ 2 1 1 1 1 1 1 1 1 1 ]
[ 3]  [ 2 2 1 1 1 1 1 1 1 ]
[ 4]  [ 2 2 2 1 1 1 1 1 ]
[ 5]  [ 2 2 2 2 1 1 1 ]
[ 6]  [ 2 2 2 2 2 1 ]
[ 7]  [ 3 2 1 1 1 1 1 1 ]
[ 8]  [ 3 2 2 1 1 1 1 ]
[ 9]  [ 3 2 2 2 1 1 ]
[10]  [ 3 2 2 2 2 ]
[11]  [ 3 3 2 1 1 1 ]
[12]  [ 3 3 2 2 1 ]
[13]  [ 3 3 3 2 ]
[14]  [ 4 3 2 1 1 ]
[15]  [ 4 3 2 2 ]
[16]  [ 4 4 3 ]
[17]  [ 6 5 ]
[18]  [ 11 ]
The a(11)=18 partitions of 11 where no part (except possibly the largest) is repeated are
[ 1]  [ 1 1 1 1 1 1 1 1 1 1 1 ]
[ 2]  [ 2 2 2 2 2 1 ]
[ 3]  [ 3 3 3 2 ]
[ 4]  [ 4 4 2 1 ]
[ 5]  [ 4 4 3 ]
[ 6]  [ 5 3 2 1 ]
[ 7]  [ 5 4 2 ]
[ 8]  [ 5 5 1 ]
[ 9]  [ 6 3 2 ]
[10]  [ 6 4 1 ]
[11]  [ 6 5 ]
[12]  [ 7 3 1 ]
[13]  [ 7 4 ]
[14]  [ 8 2 1 ]
[15]  [ 8 3 ]
[16]  [ 9 2 ]
[17]  [ 10 1 ]
[18]  [ 11 ]
(End)
		

Crossrefs

Sequences "number of partitions with max diff d": A000005 (d=0, for n>=1), this sequence (d=1), A224956 (d=2), A238863 (d=3), A238864 (d=4), A238865 (d=5), A238866 (d=6), A238867 (d=7), A238868 (d=8), A238869 (d=9), A000041 (d --> infinity).

Programs

  • Maple
    g:= 1+sum(x^j*product(1+x^i, i=1..j-1)/(1-x^j), j=1..60): gser:=series(g, x=0, 55): seq(coeff(gser, x, n), n=0..50); # Emeric Deutsch, Feb 23 2006
    # second Maple program:
    b:= proc(n, i) option remember;
          `if`(n=0, 1, `if`(i<1, 0, add(b(n-i*j, i-1), j=1..n/i)))
        end:
    a:= n-> add(b(n, k), k=0..n):
    seq(a(n), n=0..70);  # Alois P. Heinz, Jul 06 2012
  • Mathematica
    nn=54;Drop[CoefficientList[Series[Sum[x^i/(1-x^i)Product[1+x^j,{j,1,i-1}],{i,1,nn}],{x,0,nn}],x],1] (* Geoffrey Critzer, Sep 28 2013 *)
    b[n_, i_] := b[n, i] = If[n==0, 1, If[i<1, 0, Sum[b[n-i*j, i-1], {j, 1, n/i}]]]; a[n_] := Sum[b[n, k], {k, 1, n}]; Table[a[n], {n, 1, 70}] (* Jean-François Alcover, Mar 24 2015, after Alois P. Heinz *)
    a[ n_] := SeriesCoefficient[ Sum[ x^k / (1 - x^k) QPochhammer[ -x, x, k - 1] // FunctionExpand, {k, n}], {x, 0, n}]; (* Michael Somos, Aug 07 2017 *)
  • PARI
    N = 66;  x = 'x + O('x^N);
    gf = sum(n=1,N, x^n/(1-x^n) * prod(k=1,n-1,1+x^k) );
    v = Vec(gf)
    /* Joerg Arndt, Apr 21 2013 */
    
  • PARI
    {a(n) = my(t); if( n<1, 0, polcoeff(sum(k=1, n, (t *= 1 + x^k) * x^k / (1 - x^(2*k)), t = 1 + x * O(x^n)), n))}; /* Michael Somos, Aug 07 2017 */
    
  • PARI
    {a(n) = my(c); forpart(p=n, c++; for(i=1, #p-1, if( p[i+1] > p[i] + 1, c--; break))); c}; /* Michael Somos, Aug 13 2017 */
    
  • Python
    from sympy.core.cache import cacheit
    @cacheit
    def b(n, i): return 1 if n==0 else 0 if i<1 else sum(b(n - i*j, i - 1) for j in range(1, n//i + 1))
    def a(n): return sum(b(n, k) for k in range(n + 1))
    print([a(n) for n in range(71)]) # Indranil Ghosh, Aug 14 2017, after Maple code by Alois P. Heinz

Formula

G.f.: x/(1-x) + x^2/(1-x^2)*(1+x) + x^3/(1-x^3)*(1+x)*(1+x^2) + x^4/(1-x^4)*(1+x)*(1+x^2)*(1+x^3) + x^5/(1-x^5)*(1+x)*(1+x^2)*(1+x^3)*(1+x^4) + ... . - Emeric Deutsch and Vladeta Jovovic, Feb 22 2006
a(n) = Sum_{k=0..1} A238353(n,k). - Alois P. Heinz, Mar 09 2014
a(n) ~ exp(Pi*sqrt(n/3)) / (4*3^(1/4)*n^(3/4)). - Vaclav Kotesovec, May 24 2018

Extensions

More terms from Emeric Deutsch, Feb 23 2006
a(0)=1 prepended by Alois P. Heinz, Aug 14 2017

A003116 Expansion of the reciprocal of the g.f. defining A039924.

Original entry on oeis.org

1, 1, 2, 4, 7, 13, 23, 41, 72, 127, 222, 388, 677, 1179, 2052, 3569, 6203, 10778, 18722, 32513, 56455, 98017, 170161, 295389, 512755, 890043, 1544907, 2681554, 4654417, 8078679, 14022089, 24337897, 42242732, 73319574, 127258596, 220878683
Offset: 0

Views

Author

Keywords

Comments

Conjecture: a(n) is the number of compositions p(1) + p(2) + ... + p(m) = n with p(i)-p(i-1) <= 1, see example; cf. A034297. - Vladeta Jovovic, Feb 09 2004
Row sums and central terms of the triangle in A168396: a(n) = A168396(2*n+1,n) and for n > 0: a(n) = Sum_{k=1..n} A168396(n,k). - Reinhard Zumkeller, Sep 13 2013
Former definition was "Expansion of reciprocal of a determinant." - N. J. A. Sloane, Aug 10 2018
From Doron Zeilberger, Aug 10 2018: (Start)
Jovovic's conjecture can be proved as follows. There is a sign-changing involution defined on pairs (L1,L2) where L1 is a partition with difference >= 2 between consecutive parts and L2 is the number of compositions described by Jovovic, with the sign (-1)^(Number of parts of L1).
Let a be the largest part of L1 and b the largest part of L2. If b-a>=2 then move b from L2 to the top of L1, otherwise move a to the top of L2.
Since this is an involution and it changes the sign (the number of parts of L1 changes parity) this proves it, since the g.f. of A039924 is exactly the signed-enumeration of the set given by L1. (End)

Examples

			From _Joerg Arndt_, Dec 29 2012: (Start)
There are a(6)=23 compositions p(1)+p(2)+...+p(m)=6 such that p(k)-p(k-1) <= 1:
[ 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]  [ 2 3 1 ]
[16]  [ 3 1 1 1 ]
[17]  [ 3 1 2 ]
[18]  [ 3 2 1 ]
[19]  [ 3 3 ]
[20]  [ 4 1 1 ]
[21]  [ 4 2 ]
[22]  [ 5 1 ]
[23]  [ 6 ]
Replacing the condition with p(k)-p(k-1) <= 0 gives integer partitions.
(End)
		

References

  • D. H. Lehmer, Combinatorial and cyclotomic properties of certain tridiagonal matrices. Proceedings of the Fifth Southeastern Conference on Combinatorics, Graph Theory, and Computing (Florida Atlantic Univ., Boca Raton, Fla., 1974), pp. 53-74. Congressus Numerantium, No. X, Utilitas Math., Winnipeg, Man., 1974. MR0441852.
  • H. P. Robinson, Letter to N. J. A. Sloane, Nov 19 1973.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a003116 n = a168396 (2 * n + 1) n  -- Reinhard Zumkeller, Sep 13 2013
  • Mathematica
    max = 35; f[x_] := 1/Sum[x^k^2*((-1)^k/Product[1 - x^i, {i, 1, k}]), {k, 0, Floor[Sqrt[max]]}]; CoefficientList[ Series[f[x], {x, 0, max}], x](* Jean-François Alcover, Jun 12 2012, after PARI *)
    b[n_, k_] := b[n, k] = Expand[If[n == 0, 1, x*
         Sum[b[n - j, j], {j, 1, Min[n, k + 1]}]]];
    a[n_] := Total@CoefficientList[b[n, n], x];
    Table[a[n], {n, 0, 35}] (* Jean-François Alcover, Apr 14 2022, after Alois P. Heinz in A168443 *)
  • PARI
    a(n)=if(n<0,0,polcoeff(1/sum(k=0,sqrtint(n),x^k^2/prod(i=1,k,x^i-1,1+x*O(x^n))),n))
    

Formula

G.f.: 1/(Sum_{k>=0} x^(k^2)(-1)^k/(Product_{i=1..k} 1-x^i)).
a(n) ~ c * d^n, where d = 1/A347901 = 1.73566282453034742565826074971966853... and c = 0.9180565304926754125870866477349969555868577236908640010903420353... - Vaclav Kotesovec, Nov 01 2021

Extensions

Definition revised by N. J. A. Sloane, Aug 10 2018 at the suggestion of Doron Zeilberger

A214248 Number A(n,k) of compositions of n where differences between neighboring parts are in {-k,...,k}; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 4, 3, 1, 1, 2, 4, 6, 2, 1, 1, 2, 4, 8, 11, 4, 1, 1, 2, 4, 8, 14, 17, 2, 1, 1, 2, 4, 8, 16, 27, 29, 4, 1, 1, 2, 4, 8, 16, 30, 49, 47, 3, 1, 1, 2, 4, 8, 16, 32, 59, 92, 78, 4, 1, 1, 2, 4, 8, 16, 32, 62, 113, 170, 130, 2
Offset: 0

Views

Author

Alois P. Heinz, Jul 08 2012

Keywords

Examples

			A(3,0) = 2: [3], [1,1,1].
A(4,1) = 6: [4], [2,2], [2,1,1], [1,2,1], [1,1,2], [1,1,1,1].
A(5,2) = 14: [5], [3,2], [3,1,1], [2,3], [2,2,1], [2,1,2], [2,1,1,1], [1,3,1], [1,2,2], [1,2,1,1], [1,1,3], [1,1,2,1], [1,1,1,2], [1,1,1,1,1].
Square array A(n,k) begins:
  1,  1,  1,  1,  1,  1,  1,  1, ...
  1,  1,  1,  1,  1,  1,  1,  1, ...
  2,  2,  2,  2,  2,  2,  2,  2, ...
  2,  4,  4,  4,  4,  4,  4,  4, ...
  3,  6,  8,  8,  8,  8,  8,  8, ...
  2, 11, 14, 16, 16, 16, 16, 16, ...
  4, 17, 27, 30, 32, 32, 32, 32, ...
  2, 29, 49, 59, 62, 64, 64, 64, ...
		

Crossrefs

Columns k=0-2 give: A000005, A034297, A214255.
Main diagonal gives: A011782.

Programs

  • Maple
    b:= proc(n, i, k) option remember;
          `if`(n<1 or i<1, 0, `if`(n=i, 1, add(b(n-i, i+j, k), j={$-k..k})))
        end:
    A:= (n, k)-> `if`(n=0, 1, add(b(n, j, k), j=1..n)):
    seq(seq(A(n, d-n), n=0..d), d=0..15);
  • Mathematica
    b[n_, i_, k_] := b[n, i, k] = If[n < 1 || i < 1, 0, If[n == i, 1, Sum[b[n - i, i + j, k], {j, -k, k}]]]; A[n_, k_] := If[n == 0, 1, Sum[b[n, j, k], {j, 1, n}]]; Table[Table[A[n, d - n], {n, 0, d}], {d, 0, 15}] // Flatten (* Jean-François Alcover, Dec 27 2013, translated from Maple *)

A186085 Number of 1-dimensional sandpiles with n grains.

Original entry on oeis.org

1, 1, 1, 1, 2, 3, 5, 8, 13, 22, 36, 60, 100, 166, 277, 461, 769, 1282, 2137, 3565, 5945, 9916, 16540, 27589, 46022, 76769, 128062, 213628, 356366, 594483, 991706, 1654352, 2759777, 4603843, 7680116, 12811951, 21372882, 35654237, 59478406, 99221923, 165522118, 276124217, 460630839
Offset: 0

Views

Author

Joerg Arndt, Feb 12 2011

Keywords

Comments

Number of compositions of n where the first and the last parts are 1 and the absolute difference between consecutive parts is <=1 (smooth compositions).
Such a composition [c1,c2,c3,...] corresponds to a sandpile with c1(=1) grains in the first positions, c2 in the second, and so on. Assuming the critical slope is 1 (for the pile to be stable) we obtain the conditions on the compositions.
With the additional requirement of unimodality one gets A001522. [Joerg Arndt, Dec 09 2012]
Dropping the requirement that the first and last parts are 1 gives A034297. Restriction to weakly increasing (or decreasing) sums gives A034296. [Joerg Arndt, Jun 02 2013]
Also the number of compositions of n with first part 1, up-steps of at most 1, and no two consecutive up-steps. The sandpiles are recovered by shifting the rows above the bottom row to the left by one position relative to the next lower row. [Joerg Arndt, Mar 30 2014]
Also fountains of coins (cf. A005169) with no consecutive up-steps. Shift the top rows in the previous comment by half a position. [Joerg Arndt, Mar 30 2014]

Examples

			The a(7)=8 smooth compositions of 7 are:
:   1:      [ 1 1 1 1 1 1 1 ]  (composition)
:
: ooooooo  (rendering of sandpile)
:
:   2:      [ 1 1 1 1 2 1 ]
:
:     o
: oooooo
:
:   3:      [ 1 1 1 2 1 1 ]
:
:    o
: oooooo
:
:   4:      [ 1 1 2 1 1 1 ]
:
:   o
: oooooo
:
:   5:      [ 1 1 2 2 1 ]
:
:   oo
: ooooo
:
:   6:      [ 1 2 1 1 1 1 ]
:
:  o
: oooooo
:
:   7:      [ 1 2 1 2 1 ]
:
:  o o
: ooooo
:
:   8:      [ 1 2 2 1 1 ]
:
:  oo
: ooooo
		

Crossrefs

Cf. A186084 (sandpiles by base length).
Cf. A005169 (compositions of n with c(1)=1 and c(i+1)<=c(i)+1).
Cf. A186505 (antidiagonal sums of triangle A186084).
Cf. A129181.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, `if`(i=1, 1, 0),
          `if`(n<0 or i<1, 0, add(b(n-i, i+j), j=-1..1)))
        end:
    a:= n-> `if`(n=0, 1, b(n-1, 1)):
    seq(a(n), n=0..50);  # Alois P. Heinz, Jun 11 2013
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, If[i == 1, 1, 0], If[n<0 || i<1, 0, Sum[b[n-i, i+j], {j, -1, 1}]]]; a[n_] := If[n == 0, 1, b[n-1, 1]]; Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Feb 03 2014, after Alois P. Heinz *)
  • PARI
    {a(n)=local(Txy=1+x*y); for(i=1, n, Txy=1/(1-x*y-x^3*y^2*subst(Txy, y, x*y+x*O(x^n)))); polcoeff(subst(1+x*Txy, y, 1), n, x)} /* Paul D. Hanna */
    
  • PARI
    /* continued fraction for terms up to 460630839: */
    Vec(1/ (1-x/ (1-x^3/ (1-x^2/ (1-x^3/ (1-x^7/ (1-x^4/ (1-x^5/ (1-x^11/ (1-x^6/(1-x*O(x^0) ))))))))))) /* Paul D. Hanna */
    
  • PARI
    N = 66; x = 'x + O('x^N);
    Q(k) = if(k>N, 1, 1/x^(k+1) - 1 - 1/Q(k+1) );
    gf = 1 + 1/Q(0);
    Vec(gf) /* Joerg Arndt, May 07 2013 */

Formula

G.f.: 1 + x/(1-x - x^3*B(x)) where B(x) equals the g.f. of the antidiagonal sums of triangle A186084 [Paul D. Hanna].
G.f.: 1 + x/(1-x - x^3/(1-x^2 - x^5/(1-x^3 - x^7/(1-x^4 - x^9/(1 -...))))) (continued fraction). [Paul D. Hanna].
G.f.: 1/(1 - x/(1-x^3/(1-x^2/(1 - x^3/(1-x^7/(1-x^4/(1 - x^5/(1-x^11/(1-x^6/(1 -...)))))))))) (continued fraction). [Paul D. Hanna].
The g.f. T(x,y) of triangle A186084 satisfies: T(x,y) = 1/(1 - x*y - x^3*y^2*T(x,x*y)); therefore, the g.f. of this sequence is A(x) = 1 + x*T(x,1). [Paul D. Hanna]
a(n) ~ c/r^n where r = 0.5994477646147968266874606710272382... and c = 0.213259838728143595595398989847345... [Paul D. Hanna]
G.f.: 1 + 1/Q(0), where Q(k)= 1/x^(k+1) - 1 - 1/Q(k+1); (continued fraction). - Sergei N. Gladkovskii, May 07 2013
G.f.: G(1), where G(k) = 1 + x^k/( 1 - x^k * G(k+1) ) (continued fraction). [Joerg Arndt, Jun 29 2013]
a(n) = Sum_{j=1..n} A129181(n-j,j-1) for n>=1. - Alois P. Heinz, Jun 25 2023

A325547 Number of compositions of n with strictly increasing differences.

Original entry on oeis.org

1, 1, 2, 3, 6, 8, 11, 18, 24, 30, 45, 57, 71, 96, 120, 148, 192, 235, 286, 354, 431, 518, 628, 752, 893, 1063, 1262, 1482, 1744, 2046, 2386, 2775, 3231, 3733, 4305, 4977, 5715, 6536, 7507, 8559, 9735, 11112, 12608, 14252, 16177, 18265, 20553, 23204, 26090, 29223
Offset: 0

Views

Author

Gus Wiseman, May 10 2019

Keywords

Comments

A composition of n is a finite sequence of positive integers summing to n.
The differences of a sequence are defined as if the sequence were increasing, so for example the differences of (3,1,2) are (-2,1).

Examples

			The a(1) = 1 through a(6) = 11 compositions:
  (1)  (2)   (3)   (4)    (5)    (6)
       (11)  (12)  (13)   (14)   (15)
             (21)  (22)   (23)   (24)
                   (31)   (32)   (33)
                   (112)  (41)   (42)
                   (211)  (113)  (51)
                          (212)  (114)
                          (311)  (213)
                                 (312)
                                 (411)
                                 (2112)
		

Crossrefs

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],Less@@Differences[#]&]],{n,0,15}]
  • PARI
    \\ Row sums of R(n) give A179269 (breakdown by width)
    R(n)={my(L=List(), v=vectorv(n, i, 1), w=1, t=1); while(v, listput(L,v); w++; t+=w; v=vectorv(n, i, sum(k=1, (i-1)\t, v[i-k*t]))); Mat(L)}
    seq(n)={my(M=R(n)); Vec(1 + sum(i=1, n, my(p=sum(w=1, min(#M,n\i), x^(w*i)*sum(j=1, n-i*w, x^j*M[j,w])));  x^i*(1 + x^i)*(1 + p + O(x*x^(n-i)))^2))} \\ Andrew Howroyd, Aug 27 2019

Extensions

a(26)-a(42) from Lars Blomberg, May 30 2019
Terms a(43) and beyond from Andrew Howroyd, Aug 27 2019

A348410 Number of nonnegative integer solutions to n = Sum_{i=1..n} (a_i + b_i), with b_i even.

Original entry on oeis.org

1, 1, 5, 19, 85, 376, 1715, 7890, 36693, 171820, 809380, 3830619, 18201235, 86770516, 414836210, 1988138644, 9548771157, 45948159420, 221470766204, 1069091485500, 5167705849460, 25009724705460, 121171296320475, 587662804774890, 2852708925078675, 13859743127937876
Offset: 0

Views

Author

César Eliud Lozada, Oct 17 2021

Keywords

Comments

Suppose n objects are to be distributed into 2n baskets, half of these white and half black. White baskets may contain 0 or any number of objects, while black baskets may contain 0 or an even number of objects. a(n) is the number of distinct possible distributions.

Examples

			Some examples (semicolon separates white basket from black baskets):
For n=1: {{1 ; 0}} - Total possible ways: 1.
For n=2: {{0, 0 ; 0, 2}, {0, 0 ; 2, 0}, {0, 2 ; 0, 0}, {1, 1 ; 0, 0}, {2, 0 ; 0, 0}} - Total possible ways: 5.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, t) option remember; `if`(t=0, 1-signum(n),
          add(b(n-j, t-1)*(1+iquo(j, 2)), j=0..n))
        end:
    a:= n-> b(n$2):
    seq(a(n), n=0..25);  # Alois P. Heinz, Oct 17 2021
  • Mathematica
    (* giveList=True produces the list of solutions *)
    (* giveList=False gives the number of solutions *)
    counter[objects_, giveList_: False] :=
      Module[{n = objects, nb, eq1, eqa, eqb, eqs, var, sol, var2, list},
       nb = n;
       eq1 = {Total[Map[a[#] + 2*b[#] &, Range[nb]]] - n == 0};
       eqa = {And @@ Map[0 <= a[#] <= n &, Range[nb]]};
       eqb = {And @@ Map[0 <= b[#] <= n &, Range[nb]]};
       eqs = {And @@ Join[eq1, eqa, eqb]};
       var = Flatten[Map[{a[#], b[#]} &, Range[nb]]];
       var = Join[Map[a[#] &, Range[nb]], Map[b[#] &, Range[nb]]];
       sol = Solve[eqs, var, Integers];
       var2 = Join[Map[a[#] &, Range[nb]], Map[2*b[#] &, Range[nb]]];
       list = Sort[Map[var2 /. # &, sol]];
       list = Map[StringReplace[ToString[#], {"," -> " ;"}, n] &, list];
       list = Map[StringReplace[#, {";" -> ","}, n - 1] &, list];
       Return[
        If[giveList, Print["Total: ", Length[list]]; list, Length[sol]]];
       ];
    (* second program: *)
    b[n_, t_] := b[n, t] = If[t == 0, 1 - Sign[n], Sum[b[n - j, t - 1]*(1 + Quotient[j, 2]), {j, 0, n}]];
    a[n_] := b[n, n];
    Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Aug 16 2023, after Alois P. Heinz *)

Formula

Conjecture: D-finite with recurrence +7168*n*(2*n-1)*(n-1)*a(n) -64*(n-1)*(1759*n^2-5294*n+5112)*a(n-1) +12*(7561*n^3-75690*n^2+165271*n-101070)*a(n-2) +5*(110593*n^3-743946*n^2+1659971*n-1232778)*a(n-3) +2680*(4*n-15)*(2*n-7)*(4*n-13)*a(n-4)=0. - R. J. Mathar, Oct 19 2021
From Vaclav Kotesovec, Nov 01 2021: (Start)
Recurrence (of order 2): 16*(n-1)*n*(2*n - 1)*(51*n^2 - 162*n + 127)*a(n) = (n-1)*(5457*n^4 - 22791*n^3 + 32144*n^2 - 17536*n + 3072)*a(n-1) + 8*(2*n - 3)*(4*n - 7)*(4*n - 5)*(51*n^2 - 60*n + 16)*a(n-2).
a(n) ~ sqrt(3 + 5/sqrt(17)) * (107 + 51*sqrt(17))^n / (sqrt(Pi*n) * 2^(6*n+2)). (End)
From Peter Bala, Feb 21 2022: (Start)
a(n) = [x^n] ( (1 - x)*(1 - x^2) )^(-n). Cf. A234839.
a(n) = Sum_{k = 0..floor(n/2)} binomial(2*n-2*k-1,n-2*k)*binomial(n+k-1,k).
exp( Sum_{n >= 1} a(n)*x^n/n ) = 1 + x + 3*x^2 + 9*x^3 + 32*x^4 + 119*x^5 + ... is the g.f. of A063020.
The Gauss congruences a(n*p^k) == a(n*p^(k-1)) (mod p^k) hold for all primes p and positive integers n and k.
Conjecture: the supercongruences a(n*p^k) == a(n*p^(k-1)) (mod p^(3*k)) hold for all primes p >= 5 and positive integers n and k.
The o.g.f. A(x) is the diagonal of the bivariate rational function 1/(1 - t/((1-x)*(1-x^2))) and hence is an algebraic function over Q(x) by Stanley 1999, Theorem 6.33, p. 197.
Let F(x) = (1/x)*Series_Reversion( x*(1-x)*(1-x^2) ). Then A(x) = 1 + x*d/dx (log(F(x))). (End)
a(n) = Sum_{k = 0..n} (-1)^(n+k)*binomial(2*n+k-1, k)*binomial(2*n-k-1, n-k). Cf. A352373. - Peter Bala, Jun 05 2024

Extensions

More terms from Alois P. Heinz, Oct 17 2021

A214246 Number A(n,k) of compositions of n where differences between neighboring parts are in {-k,0,k}; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 4, 3, 1, 1, 2, 2, 6, 2, 1, 1, 2, 2, 5, 11, 4, 1, 1, 2, 2, 3, 5, 17, 2, 1, 1, 2, 2, 3, 4, 10, 29, 4, 1, 1, 2, 2, 3, 2, 7, 10, 47, 3, 1, 1, 2, 2, 3, 2, 6, 8, 21, 78, 4, 1, 1, 2, 2, 3, 2, 4, 5, 9, 22, 130, 2
Offset: 0

Views

Author

Alois P. Heinz, Jul 08 2012

Keywords

Examples

			A(3,0) = 2: [3], [1,1,1].
A(4,1) = 6: [4], [2,2], [2,1,1], [1,2,1], [1,1,2], [1,1,1,1].
A(5,2) = 5: [5], [3,1,1], [1,3,1], [1,1,3], [1,1,1,1,1].
A(6,3) = 7: [6], [4,1,1], [3,3], [2,2,2], [1,4,1], [1,1,4], [1,1,1,1,1,1].
Square array A(n,k) begins:
  1,  1,  1,  1,  1,  1,  1,  1, ...
  1,  1,  1,  1,  1,  1,  1,  1, ...
  2,  2,  2,  2,  2,  2,  2,  2, ...
  2,  4,  2,  2,  2,  2,  2,  2, ...
  3,  6,  5,  3,  3,  3,  3,  3, ...
  2, 11,  5,  4,  2,  2,  2,  2, ...
  4, 17, 10,  7,  6,  4,  4,  4, ...
  2, 29, 10,  8,  5,  4,  2,  2, ...
		

Crossrefs

Column k=0 and main diagonal give: A000005.
Columns k=1, 2 give: A034297, A214253.

Programs

  • Maple
    b:= proc(n, i, k) option remember;
          `if`(n<1 or i<1, 0, `if`(n=i, 1, add(b(n-i, i+j, k), j={-k, 0, k})))
        end:
    A:= (n, k)-> `if`(n=0, 1, add(b(n, j, k), j=1..n)):
    seq(seq(A(n, d-n), n=0..d), d=0..15);
  • Mathematica
    b[n_, i_, k_] := b[n, i, k] = If[n < 1 || i < 1, 0, If[n == i, 1, Sum[b[n - i, i + j, k], {j, Union[{-k, 0, k}]}]]]; A[n_, k_] := If[n == 0, 1, Sum[b[n, j, k], {j, 1, n}]]; Table[Table[A[n, d - n], {n, 0, d}], {d, 0, 15}] // Flatten (* Jean-François Alcover, Dec 27 2013, translated from Maple *)

A325549 Number of necklace compositions of n with distinct circular differences.

Original entry on oeis.org

1, 1, 2, 3, 5, 4, 10, 16, 23, 34, 53, 66, 113, 164, 262, 380, 567, 821, 1217, 1778, 2702, 3919, 5760, 8520, 12375
Offset: 1

Views

Author

Gus Wiseman, May 10 2019

Keywords

Comments

A necklace composition of n is a finite sequence of positive integers summing to n that is lexicographically minimal among all of its cyclic rotations.
The circular differences of a composition c of length k are c_{i + 1} - c_i for i < k and c_1 - c_i for i = k. For example, the circular differences of (1,2,1,3) are (1,-1,2,-2).

Examples

			The a(1) = 1 through a(8) = 16 necklace compositions:
  (1)  (2)  (3)   (4)    (5)    (6)    (7)     (8)
            (12)  (13)   (14)   (15)   (16)    (17)
                  (112)  (23)   (24)   (25)    (26)
                         (113)  (114)  (34)    (35)
                         (122)         (115)   (116)
                                       (124)   (125)
                                       (133)   (134)
                                       (142)   (143)
                                       (223)   (152)
                                       (1213)  (224)
                                               (233)
                                               (1124)
                                               (1142)
                                               (1214)
                                               (11213)
                                               (11312)
		

Crossrefs

Programs

  • Mathematica
    neckQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],neckQ[#]&&UnsameQ@@Append[Differences[#],First[#]-Last[#]]&]],{n,15}]

A325589 Number of compositions of n whose circular differences are all 1 or -1.

Original entry on oeis.org

0, 0, 2, 0, 2, 2, 2, 4, 4, 2, 8, 6, 8, 10, 12, 16, 18, 20, 28, 34, 42, 48, 62, 78, 92, 112, 146, 174, 216, 264, 326, 412, 500, 614, 770, 944, 1166, 1444, 1784, 2214, 2730, 3366, 4182, 5164, 6386, 7898, 9770, 12098, 14950, 18488, 22894, 28312, 35020, 43330, 53606
Offset: 1

Views

Author

Gus Wiseman, May 11 2019

Keywords

Comments

A composition of n is a finite sequence of positive integers summing to n.
The circular differences of a composition c of length k are c_{i + 1} - c_i for i < k and c_1 - c_i for i = k. For example, the circular differences of (1,2,1,3) are (1,-1,2,-2).

Examples

			The a(3) = 2 through a(11) = 8 compositions (empty columns not shown):
  (12)  (23)  (1212)  (34)  (1232)  (45)      (2323)  (56)
  (21)  (32)  (2121)  (43)  (2123)  (54)      (3232)  (65)
                            (2321)  (121212)          (121232)
                            (3212)  (212121)          (123212)
                                                      (212123)
                                                      (212321)
                                                      (232121)
                                                      (321212)
		

Crossrefs

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],SameQ[1,##]&@@Abs[Differences[Append[#,First[#]]]]&]],{n,15}]
  • PARI
    step(R,n,s)={matrix(n, n, i, j, if(i>j, if(j>s, R[i-j, j-s]) + if(j+s<=n, R[i-j, j+s])) )}
    a(n)={sum(k=1, n, my(R=matrix(n,n,i,j,i==j&&abs(i-k)==1), t=0); while(R, R=step(R,n,1); t+=R[n,k]); t)} \\ Andrew Howroyd, Aug 23 2019

Extensions

Terms a(26) and beyond from Andrew Howroyd, Aug 23 2019

A325590 Number of necklace compositions of n with circular differences all equal to 1 or -1.

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 4, 3, 3, 4, 4, 5, 7, 6, 7, 10, 10, 11, 15, 16, 18, 23, 25, 32, 38, 43, 53, 64, 73, 89, 108, 131, 153, 188, 223, 272, 329, 395, 475, 583, 697, 848, 1027, 1247, 1506, 1837, 2223, 2708, 3282, 3993, 4848, 5913, 7175, 8745, 10640
Offset: 1

Views

Author

Gus Wiseman, May 12 2019

Keywords

Comments

A necklace composition of n is a finite sequence of positive integers summing to n that is lexicographically minimal among all of its cyclic rotations.
The circular differences of a sequence c of length k are c_{i + 1} - c_i for i < k and c_1 - c_i for i = k. For example, the circular differences of (1,2,1,3) are (1,-1,2,-2).
Up to rotation, a(n) is the number of ways to arrange positive integers summing to n in a circle such that adjacent parts differ by 1 or -1.

Examples

			The first 16 terms count the following compositions:
   3: (12)
   5: (23)
   6: (1212)
   7: (34)
   8: (1232)
   9: (45)
   9: (121212)
  10: (2323)
  11: (56)
  11: (121232)
  12: (2343)
  12: (12121212)
  13: (67)
  13: (123232)
  14: (3434)
  14: (12121232)
  15: (78)
  15: (123432)
  15: (232323)
  15: (1212121212)
  16: (3454)
  16: (12321232)
  16: (12123232)
The a(21) = 7 necklace compositions:
  (10,11)
  (2,3,4,5,4,3)
  (3,4,3,4,3,4)
  (1,2,1,2,1,2,3,4,3,2)
  (1,2,3,2,1,2,3,2,3,2)
  (1,2,1,2,3,2,3,2,3,2)
  (1,2,1,2,1,2,1,2,1,2,1,2,1,2)
		

Crossrefs

Programs

  • Mathematica
    neckQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],neckQ[#]&&(SameQ[1,##]&@@Abs[Differences[Append[#,First[#]]]])&]],{n,15}]
  • PARI
    step(R,n,s)={matrix(n,n,i,j, if(i>j, if(j>s, R[i-j, j-s]) + if(j+s<=n, R[i-j, j+s])) )}
    a(n)={sum(k=1, n, my(R=matrix(n,n,i,j,i==j&&abs(i-k)==1), t=0, m=1); while(R, R=step(R,n,1); m++; t+=sumdiv(n, d, R[d,k]*d*eulerphi(n/d))/m ); t/n)} \\ Andrew Howroyd, Aug 23 2019

Extensions

a(26)-a(40) from Lars Blomberg, Jun 11 2019
Terms a(41) and beyond from Andrew Howroyd, Aug 23 2019
Showing 1-10 of 15 results. Next