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.

A238872 Number of strongly unimodal compositions of n with absolute difference of successive parts = 1.

Original entry on oeis.org

1, 1, 1, 3, 2, 3, 3, 4, 3, 6, 4, 3, 5, 6, 4, 9, 5, 3, 7, 7, 5, 9, 6, 6, 8, 9, 5, 9, 8, 6, 10, 6, 5, 15, 8, 9, 10, 7, 7, 12, 10, 3, 11, 15, 7, 15, 8, 6, 13, 12, 9, 12, 9, 9, 14, 12, 7, 15, 12, 6, 15, 13, 6, 21, 12, 12, 13, 6, 11, 15, 15, 9, 14, 12, 8, 24, 10, 9
Offset: 0

Views

Author

Joerg Arndt, Mar 21 2014

Keywords

Examples

			The a(33) = 15 such compositions of 33 are:
01:  [ 1 2 3 4 5 6 5 4 3 ]
02:  [ 2 3 4 5 6 7 6 ]
03:  [ 3 4 5 6 5 4 3 2 1 ]
04:  [ 3 4 5 6 7 8 ]
05:  [ 4 5 6 7 6 5 ]
06:  [ 5 6 7 6 5 4 ]
07:  [ 5 6 7 8 7 ]
08:  [ 6 7 6 5 4 3 2 ]
09:  [ 7 8 7 6 5 ]
10:  [ 8 7 6 5 4 3 ]
11:  [ 10 11 12 ]
12:  [ 12 11 10 ]
13:  [ 16 17 ]
14:  [ 17 16 ]
15:  [ 33 ]
G.f. = 1 + x + x^2 + 3*x^3 + 2*x^4 + 3*x^5 + 3*x^6 + 4*x^7 + 3*x^8 + 6*x^9 + ...
		

Crossrefs

Programs

  • Mathematica
    a[ n_] := If[ n < 1, Boole[n == 0], If[ OddQ[n], 1, 1/3] Length @ FindInstance[ {x >= 0, y >= 0, z >= 0, x y + y z + z x + x + y + z + 1 == n}, {x, y, z}, Integers, 10^9]]; (* Michael Somos, Jul 04 2015 *)
    a[ n_] := If[ n < 1, Boole[n == 0], Length @ FindInstance[ {1 <= y <= n, 1 <= x <= y, 1 <= z <= y, y^2 + (x - x^2 + z - z^2) / 2 == n}, {x, y, z}, Integers, 10^9]]; (* Michael Somos, Jul 04 2015 *)
  • PARI
    \\ generate the compositions
    a(n)=
    {
        if ( n==0, return(1) );
        my( ret=0 );
        my( as, ts );
        for (f=1, n,  \\ first part
            as = 0;
            for (p=f, n, \\ numper of parts in rising half
                as += p; \\ ascending sum
                if ( as > n, break() );
                if ( as == n,  ret+=1;  break() );
                ts = as;  \\ total sum
                forstep (q=p-1, 1, -1,
                    ts += q;  \\ descending sum
                    if ( ts > n, break() );
                    if ( ts == n,  ret+=1;  break() );
                );
            );
        );
        return( ret );
    }
    v=vector(100,n,a(n-1))

Formula

a(2*n) = A130695(2*n) / 3 if n>0. a(2*n + 1) = A130695(2*n + 1) = 3 * H(8*n + 3), where H is the Hurwitz class number, if n>0. - Michael Somos, Jul 04 2015