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 34 results. Next

A065608 Sum of divisors of n minus the number of divisors of n.

Original entry on oeis.org

0, 1, 2, 4, 4, 8, 6, 11, 10, 14, 10, 22, 12, 20, 20, 26, 16, 33, 18, 36, 28, 32, 22, 52, 28, 38, 36, 50, 28, 64, 30, 57, 44, 50, 44, 82, 36, 56, 52, 82, 40, 88, 42, 78, 72, 68, 46, 114, 54, 87, 68, 92, 52, 112, 68, 112, 76, 86, 58, 156, 60, 92, 98, 120, 80, 136, 66, 120, 92
Offset: 1

Views

Author

Jason Earls, Nov 06 2001

Keywords

Comments

Number of permutations p of {1,2,...,n} such that p(k)-k takes exactly two distinct values. Example: a(4)=4 because we have 4123, 3412, 2143 and 2341. - Max Alekseyev and Emeric Deutsch, Dec 22 2006
Number of solutions to the Diophantine equation xy + yz = n, with x,y,z >= 1.
In other words, number of ways to write n = (a + b) * k for positive integers a, b, k. - Gus Wiseman, Mar 25 2021
Not the same as A184396(n): a(66) = 136 while A184396(66) = 137. - Wesley Ivan Hurt, Dec 26 2013
From Gus Wiseman, Mar 25 2021: (Start)
Also the number of compositions of n into an even number of parts with alternating parts equal. These are finite even-length sequences q of positive integers summing to n such that q(i) = q(i+2) for all possible i. For example, the a(2) = 1 through a(8) = 11 compositions are:
(1,1) (1,2) (1,3) (1,4) (1,5) (1,6) (1,7)
(2,1) (2,2) (2,3) (2,4) (2,5) (2,6)
(3,1) (3,2) (3,3) (3,4) (3,5)
(1,1,1,1) (4,1) (4,2) (4,3) (4,4)
(5,1) (5,2) (5,3)
(1,2,1,2) (6,1) (6,2)
(2,1,2,1) (7,1)
(1,1,1,1,1,1) (1,3,1,3)
(2,2,2,2)
(3,1,3,1)
(1,1,1,1,1,1,1,1)
The odd-length version is A062968.
The version with alternating parts weakly decreasing is A114921, or A342528 if odd-length compositions are included.
The version with alternating parts unequal is A342532, or A224958 if odd-length compositions are included (unordered: A339404/A000726).
Allowing odd lengths as well as even gives A342527.
(End)
Inverse Möbius transform of n-1. - Wesley Ivan Hurt, Jun 29 2024

Crossrefs

Starting (1, 2, 4, 4, 8, 6, ...), = row sums of triangle A077478. - Gary W. Adamson, Nov 12 2007
Starting with "1" = row sums of triangle A176919. - Gary W. Adamson, Apr 29 2010
Column k=2 of A125182.
A175342/A325545 count compositions with constant/distinct differences.

Programs

  • GAP
    List([1..100],n->Sigma(n)-Tau(n)); # Muniru A Asiru, Mar 19 2018
    
  • Maple
    with(numtheory): seq(sigma(n)-tau(n),n=1..70); # Emeric Deutsch, Dec 22 2006
  • Mathematica
    Table[DivisorSigma[1,n]-DivisorSigma[0,n], {n,100}] (* Wesley Ivan Hurt, Dec 26 2013 *)
  • PARI
    a(n) = sigma(n) - numdiv(n); \\ Harry J. Smith, Oct 23 2009
    
  • Python
    from math import prod
    from sympy import factorint
    def A065608(n):
        f = factorint(n).items()
        return prod((p**(e+1)-1)//(p-1) for p, e in f)-prod(e+1 for p,e in f) # Chai Wah Wu, Jul 16 2022

Formula

a(n) = sigma(n) - d(n) = A000203(n) - A000005(n).
a(n) = Sum_{d|n} (d-1). - Wesley Ivan Hurt, Dec 26 2013
G.f.: Sum_{k>=1} x^(2*k)/(1-x^k)^2. - Benoit Cloitre, Apr 21 2003
G.f.: Sum_{n>=1} (n-1)*x^n/(1-x^n). - Joerg Arndt, Jan 30 2011
L.g.f.: -log(Product_{k>=1} (1 - x^k)^(1-1/k)) = Sum_{n>=1} a(n)*x^n/n. - Ilya Gutkovskiy, Mar 18 2018
G.f.: Sum_{n >= 1} q^(n^2)*( (n - 1) + q^n - (n - 1)*q^(2*n) )/(1 - q^n)^2 - differentiate equation 1 in Arndt with respect to t, then set x = q and t = q. - Peter Bala, Jan 22 2021
a(n) = A342527(n) - A062968(n). - Gus Wiseman, Mar 25 2021
a(n) = n * A010054(n) - Sum_{k>=1} a(n - k*(k+1)/2), assuming a(n) = 0 for n <= 0 (Kobayashi, 2022). - Amiram Eldar, Jun 23 2023

A069916 Number of log-concave compositions (ordered partitions) of n.

Original entry on oeis.org

1, 1, 2, 4, 6, 9, 14, 20, 26, 36, 47, 60, 80, 102, 127, 159, 194, 236, 291, 355, 425, 514, 611, 718, 856, 1009, 1182, 1381, 1605, 1861, 2156, 2496, 2873, 3299, 3778, 4301, 4902, 5574, 6325, 7176, 8116, 9152, 10317, 11610, 13028, 14611, 16354, 18259, 20365
Offset: 0

Views

Author

Pontus von Brömssen, Apr 24 2002

Keywords

Comments

These are compositions with weakly decreasing first quotients, where the first quotients of a sequence are defined as if the sequence were an increasing divisor chain, so for example the first quotients of (6,3,1) are (1/2,1/3). - Gus Wiseman, Mar 16 2021

Examples

			Out of the 8 compositions of 4, only 2+1+1 and 1+1+2 are not log-concave, so a(4)=6.
From _Gus Wiseman_, Mar 15 2021: (Start)
The a(1) = 1 through a(6) = 14 compositions:
  (1)  (2)   (3)    (4)     (5)      (6)
       (11)  (12)   (13)    (14)     (15)
             (21)   (22)    (23)     (24)
             (111)  (31)    (32)     (33)
                    (121)   (41)     (42)
                    (1111)  (122)    (51)
                            (131)    (123)
                            (221)    (132)
                            (11111)  (141)
                                     (222)
                                     (231)
                                     (321)
                                     (1221)
                                     (111111)
(End)
		

Crossrefs

The version for differences instead of quotients is A070211.
A000005 counts constant compositions.
A000009 counts strictly increasing (or strictly decreasing) compositions.
A000041 counts weakly increasing (or weakly decreasing) compositions.
A001055 counts factorizations.
A002843 counts compositions with adjacent parts x <= 2y.
A003238 counts chains of divisors summing to n-1, with strict case A122651.
A003242 counts anti-run compositions.
A074206 counts ordered factorizations.
A167865 counts strict chains of divisors summing to n.

Programs

  • Mathematica
    (* This program is not suitable for computing a large number of terms *)
    compos[n_] := Permutations /@ IntegerPartitions[n] // Flatten[#, 1]&;
    logConcaveQ[p_] := And @@ Table[p[[i]]^2 >= p[[i-1]]*p[[i+1]], {i, 2, Length[p]-1}]; a[n_] := Count[compos[n], p_?logConcaveQ]; Table[an = a[n]; Print["a(", n, ") = ", an]; a[n], {n, 0, 25}] (* Jean-François Alcover, Feb 29 2016 *)
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],GreaterEqual@@Divide@@@Reverse/@Partition[#,2,1]&]],{n,0,15}] (* Gus Wiseman, Mar 15 2021 *)
  • Sage
    def A069916(n) : return sum(all(p[i]^2 >= p[i-1] * p[i+1] for i in range(1, len(p)-1)) for p in Compositions(n)) # Eric M. Schmidt, Sep 29 2013

A040039 First differences of A033485; also A033485 with terms repeated.

Original entry on oeis.org

1, 1, 2, 2, 3, 3, 5, 5, 7, 7, 10, 10, 13, 13, 18, 18, 23, 23, 30, 30, 37, 37, 47, 47, 57, 57, 70, 70, 83, 83, 101, 101, 119, 119, 142, 142, 165, 165, 195, 195, 225, 225, 262, 262, 299, 299, 346, 346, 393, 393, 450, 450, 507, 507, 577, 577, 647, 647, 730, 730, 813, 813, 914, 914, 1015, 1015, 1134, 1134, 1253, 1253, 1395, 1395
Offset: 0

Views

Author

Keywords

Comments

Apparently a(n) = number of partitions (p_1, p_2, ..., p_k) of n+1, with p_1 >= p_2 >= ... >= p_k, such that for each i, p_i > p_{i+1}+...+p_k. - John McKay (mac(AT)mathstat.concordia.ca), Mar 06 2009
Comment from John McKay confirmed in paper by Bessenrodt, Olsson, and Sellers. Such partitions are called "strongly decreasing" partitions in the paper, see the function s(n) therein.
Also the number of unlabeled binary rooted trees with 2*n + 3 nodes in which the two branches directly under any given non-leaf node are either equal or at least one of them is a leaf. - Gus Wiseman, Oct 08 2018
From Gus Wiseman, Apr 06 2021: (Start)
This sequence counts both of the following essentially equivalent things:
1. Sets of distinct positive integers with maximum n + 1 in which all adjacent elements have quotients < 1/2. For example, the a(0) = 1 through a(8) = 7 subsets are:
{1} {2} {3} {4} {5} {6} {7} {8} {9}
{1,3} {1,4} {1,5} {1,6} {1,7} {1,8} {1,9}
{2,5} {2,6} {2,7} {2,8} {2,9}
{3,7} {3,8} {3,9}
{1,3,7} {1,3,8} {4,9}
{1,3,9}
{1,4,9}
2. Sets of distinct positive integers with maximum n + 1 whose first differences are term-wise greater than their decapitation (remove the maximum). For example, the set q = {1,4,9} has first differences (3,5), which are greater than (1,4), so q is counted under a(8). On the other hand, r = {1,5,9} has first differences (4,4), which are not greater than (1,5), so r is not counted under a(8).
Also the number of partitions of n + 1 into powers of 2 covering an initial interval of powers of 2. For example, the a(0) = 1 through a(8) = 7 partitions are:
1 11 21 211 221 2211 421 4211 4221
111 1111 2111 21111 2221 22211 22221
11111 111111 22111 221111 42111
211111 2111111 222111
1111111 11111111 2211111
21111111
111111111
(End)

Examples

			From _Joerg Arndt_, Dec 17 2012: (Start)
The a(19-1)=30 strongly decreasing partitions of 19 are (in lexicographic order)
[ 1]    [ 10 5 3 1 ]
[ 2]    [ 10 5 4 ]
[ 3]    [ 10 6 2 1 ]
[ 4]    [ 10 6 3 ]
[ 5]    [ 10 7 2 ]
[ 6]    [ 10 8 1 ]
[ 7]    [ 10 9 ]
[ 8]    [ 11 5 2 1 ]
[ 9]    [ 11 5 3 ]
[10]    [ 11 6 2 ]
[11]    [ 11 7 1 ]
[12]    [ 11 8 ]
[13]    [ 12 4 2 1 ]
[14]    [ 12 4 3 ]
[15]    [ 12 5 2 ]
[16]    [ 12 6 1 ]
[17]    [ 12 7 ]
[18]    [ 13 4 2 ]
[19]    [ 13 5 1 ]
[20]    [ 13 6 ]
[21]    [ 14 3 2 ]
[22]    [ 14 4 1 ]
[23]    [ 14 5 ]
[24]    [ 15 3 1 ]
[25]    [ 15 4 ]
[26]    [ 16 2 1 ]
[27]    [ 16 3 ]
[28]    [ 17 2 ]
[29]    [ 18 1 ]
[30]    [ 19 ]
The a(20-1)=30 strongly decreasing partitions of 20 are obtained by adding 1 to the first part in each partition in the list.
(End)
From _Gus Wiseman_, Oct 08 2018: (Start)
The a(-1) = 1 through a(4) = 3 semichiral binary rooted trees:
  o  (oo)  (o(oo))  ((oo)(oo))  (o((oo)(oo)))  ((o(oo))(o(oo)))
                    (o(o(oo)))  (o(o(o(oo))))  (o(o((oo)(oo))))
                                               (o(o(o(o(oo)))))
(End)
		

Crossrefs

Cf. A000123.
The equal case is A001511.
The reflected version is A045690.
The unequal (anti-run) version is A045691.
A000929 counts partitions with all adjacent parts x >= 2y.
A002843 counts compositions with all adjacent parts x <= 2y.
A018819 counts partitions into powers of 2.
A154402 counts partitions with all adjacent parts x = 2y.
A274199 counts compositions with all adjacent parts x < 2y.
A342094 counts partitions with all adjacent parts x <= 2y (strict: A342095).
A342096 counts partitions without adjacent x >= 2y (strict: A342097).
A342098 counts partitions with all adjacent parts x > 2y.
A342337 counts partitions with all adjacent parts x = y or x = 2y.

Programs

  • Maple
    # For example, the five partitions of 4, written in nonincreasing order, are
    # [1,1,1,1], [2,1,1], [2,2], [3,1], [4].
    # Only the last two satisfy the condition, and a(3)=2.
    # The Maple program below verifies this for small values of n.
    with(combinat); N:=8; a:=array(1..N); c:=array(1..N);
    for n from 1 to N do p:=partition(n); np:=nops(p); t:=0;
    for s to np do r:=p[s]; r:=sort(r,`>`); nr:=nops(r); j:=1;
    while jsum(r[k],k=j+1..nr) do j:=j+1;od; # gives A040039
    #while j= sum(r[k],k=j+1..nr) do j:=j+1;od; # gives A018819
    if j=nr then t:=t+1;fi od; a[n]:=t; od;
    # John McKay
  • Mathematica
    T[n_, m_] := T[n, m] = Sum[Binomial[n-2k-1, n-2k-m] Sum[Binomial[m, i] T[k, i], {i, 1, k}], {k, 0, (n-m)/2}] + Binomial[n-1, n-m];
    a[n_] := T[n+1, 1];
    Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Jul 27 2018, after Vladimir Kruchinin *)
    Table[Length[Select[Subsets[Range[n]],MemberQ[#,n]&&And@@Table[#[[i-1]]/#[[i]]<1/2,{i,2,Length[#]}]&]],{n,15}] (* Gus Wiseman, Apr 06 2021 *)
  • Maxima
    T(n,m):=sum(binomial(n-2*k-1,n-2*k-m)*sum(binomial(m,i)*T(k,i),i,1,k),k,0,(n-m)/2)+binomial(n-1,n-m);
    makelist(T(n+1,1),n,0,40); /* Vladimir Kruchinin, Mar 19 2015 */
    
  • PARI
    /* compute as "A033485 with terms repeated" */
    b(n) = if(n<2, 1, b(floor(n/2))+b(n-1));  /* A033485 */
    a(n) = b(n\2+1); /* note different offsets */
    for(n=0,99, print1(a(n),", ")); /* Joerg Arndt, Jan 21 2011 */
    
  • Python
    from itertools import islice
    from collections import deque
    def A040039_gen(): # generator of terms
        aqueue, f, b, a = deque([2]), True, 1, 2
        yield from (1, 1, 2, 2)
        while True:
            a += b
            yield from (a, a)
            aqueue.append(a)
            if f: b = aqueue.popleft()
            f = not f
    A040039_list = list(islice(A040039_gen(),40)) # Chai Wah Wu, Jun 07 2022

Formula

Let T(x) be the g.f, then T(x) = 1 + x/(1-x)*T(x^2) = 1 + x/(1-x) * ( 1 + x^2/(1-x^2) * ( 1 + x^4/(1-x^4) * ( 1 + x^8/(1-x^8) *(...) ))). [Joerg Arndt, May 11 2010]
From Joerg Arndt, Oct 02 2013: (Start)
G.f.: sum(k>=1, x^(2^k-1) / prod(j=0..k-1, 1-x^(2^k) ) ) [Bessenrodt/Olsson/Sellers].
G.f.: 1/(2*x^2) * ( 1/prod(k>=0, 1 - x^(2^k) ) - (1 + x) ).
a(n) = 1/2 * A018819(n+2).
(End)
a(n) = T(n+1,1), where T(n,m)=sum(k..0,(n-m)/2, binomial(n-2*k-1,n-2*k-m)*sum(i=1..k, binomial(m,i)*T(k,i)))+binomial(n-1,n-m). - Vladimir Kruchinin, Mar 19 2015
Using offset 1: a(1) = 1; a(n even) = a(n-1); a(n odd) = a(n-1) + a((n-1)/2). - Gus Wiseman, Oct 08 2018

A342528 Number of compositions with alternating parts weakly decreasing (or weakly increasing).

Original entry on oeis.org

1, 1, 2, 4, 7, 12, 20, 32, 51, 79, 121, 182, 272, 399, 582, 839, 1200, 1700, 2394, 3342, 4640, 6397, 8771, 11955, 16217, 21878, 29386, 39285, 52301, 69334, 91570, 120465, 157929, 206313, 268644, 348674, 451185, 582074, 748830, 960676, 1229208, 1568716, 1997064
Offset: 0

Views

Author

Gus Wiseman, Mar 24 2021

Keywords

Comments

These are finite sequences q of positive integers summing to n such that q(i) >= q(i+2) for all possible i.
The strict case (alternating parts are strictly decreasing) is A000041. Is there a bijective proof?
Yes. Construct a Ferrers diagram by placing odd parts horizontally and even parts vertically in a fishbone pattern. The resulting Ferrers diagram will be for an ordinary partition and the process is reversible. It does not appear that this method can be applied to give a formula for this sequence. - Andrew Howroyd, Mar 25 2021

Examples

			The a(1) = 1 through a(6) = 20 compositions:
  (1)  (2)   (3)    (4)     (5)      (6)
       (11)  (12)   (13)    (14)     (15)
             (21)   (22)    (23)     (24)
             (111)  (31)    (32)     (33)
                    (121)   (41)     (42)
                    (211)   (131)    (51)
                    (1111)  (212)    (141)
                            (221)    (222)
                            (311)    (231)
                            (1211)   (312)
                            (2111)   (321)
                            (11111)  (411)
                                     (1212)
                                     (1311)
                                     (2121)
                                     (2211)
                                     (3111)
                                     (12111)
                                     (21111)
                                     (111111)
		

Crossrefs

The even-length case is A114921.
The version with alternating parts unequal is A224958 (unordered: A000726).
The version with alternating parts equal is A342527.
A000041 counts weakly increasing (or weakly decreasing) compositions.
A000203 adds up divisors.
A002843 counts compositions with all adjacent parts x <= 2y.
A003242 counts anti-run compositions.
A069916/A342492 = decreasing/increasing first quotients.
A070211/A325546 = weakly decreasing/increasing differences.
A175342/A325545 = constant/distinct differences.
A342495 = constant first quotients (unordered: A342496, strict: A342515, ranking: A342522).

Programs

  • Maple
    b:= proc(n, i, j) option remember; `if`(n=0, 1, `if`(i<1, 0,
          b(n, i-1, j)+b(n-i, min(n-i, j), min(n-i, i))))
        end:
    a:= n-> b(n$3):
    seq(a(n), n=0..42);  # Alois P. Heinz, Jan 16 2025
  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],GreaterEqual@@Plus@@@Reverse/@Partition[#,2,1]&]],{n,0,15}]
  • PARI
    seq(n)={my(p=1/prod(k=1, n, 1-y*x^k + O(x*x^n))); Vec(1+sum(k=1, n, polcoef(p,k,y)*(polcoef(p,k-1,y) + polcoef(p,k,y))))} \\ Andrew Howroyd, Mar 24 2021

Formula

G.f.: Sum_{k>=0} ([y^k] P(x,y))*([y^k] (1 + y)*P(x,y)), where P(x,y) = Product_{k>=1} 1/(1 - y*x^k). - Andrew Howroyd, Jan 16 2025

Extensions

Terms a(21) and beyond from Andrew Howroyd, Mar 24 2021

A342527 Number of compositions of n with alternating parts equal.

Original entry on oeis.org

1, 1, 2, 4, 6, 8, 11, 12, 16, 17, 21, 20, 29, 24, 31, 32, 38, 32, 46, 36, 51, 46, 51, 44, 69, 51, 61, 60, 73, 56, 87, 60, 84, 74, 81, 76, 110, 72, 91, 88, 115, 80, 123, 84, 117, 112, 111, 92, 153, 101, 132, 116, 139, 104, 159, 120, 161, 130, 141, 116, 205, 120, 151, 156, 178, 142, 195, 132, 183, 158
Offset: 0

Views

Author

Gus Wiseman, Mar 24 2021

Keywords

Comments

These are finite sequences q of positive integers summing to n such that q(i) = q(i+2) for all possible i.

Examples

			The a(1) = 1 through a(8) = 16 compositions:
  (1)  (2)   (3)    (4)     (5)      (6)       (7)        (8)
       (11)  (12)   (13)    (14)     (15)      (16)       (17)
             (21)   (22)    (23)     (24)      (25)       (26)
             (111)  (31)    (32)     (33)      (34)       (35)
                    (121)   (41)     (42)      (43)       (44)
                    (1111)  (131)    (51)      (52)       (53)
                            (212)    (141)     (61)       (62)
                            (11111)  (222)     (151)      (71)
                                     (1212)    (232)      (161)
                                     (2121)    (313)      (242)
                                     (111111)  (12121)    (323)
                                               (1111111)  (1313)
                                                          (2222)
                                                          (3131)
                                                          (21212)
                                                          (11111111)
		

Crossrefs

The odd-length case is A062968.
The even-length case is A065608.
The version with alternating parts unequal is A224958 (unordered: A000726).
The version with alternating parts weakly decreasing is A342528.
A000005 counts constant compositions.
A000041 counts weakly increasing (or weakly decreasing) compositions.
A000203 adds up divisors.
A002843 counts compositions with all adjacent parts x <= 2y.
A003242 counts anti-run compositions.
A175342 counts compositions with constant differences.
A342495 counts compositions with constant first quotients.
A342496 counts partitions with constant first quotients (strict: A342515, ranking: A342522).

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],SameQ@@Plus@@@Reverse/@Partition[#,2,1]&]],{n,0,15}]

Formula

a(n) = 1 + n + A000203(n) - 2*A000005(n).
a(n) = A065608(n) + A062968(n).

A342337 Number of integer partitions of n with all adjacent parts (x, y) satisfying either x = y or x = 2y.

Original entry on oeis.org

1, 1, 2, 3, 4, 4, 7, 6, 9, 10, 12, 11, 19, 14, 20, 24, 27, 24, 37, 31, 44, 45, 49, 48, 71, 61, 72, 80, 92, 84, 118, 102, 128, 132, 144, 151, 191, 166, 197, 211, 244, 226, 287, 263, 313, 330, 348, 347, 435, 399, 462, 476, 524, 508, 614, 591, 674, 680, 732, 731, 890, 814, 916, 966, 1042, 1032, 1188, 1135, 1280, 1303
Offset: 0

Views

Author

Gus Wiseman, Mar 10 2021

Keywords

Examples

			The a(1) = 1 through a(9) = 10 partitions:
  1   2    3     4      5       6        7         8          9
      11   21    22     221     33       421       44         63
           111   211    2111    42       2221      422        333
                 1111   11111   222      22111     2222       4221
                                2211     211111    4211       22221
                                21111    1111111   22211      42111
                                111111             221111     222111
                                                   2111111    2211111
                                                   11111111   21111111
                                                              111111111
		

Crossrefs

The first condition alone gives A000005 (for partitions).
The second condition alone gives A154402 (for partitions).
The Heinz numbers of these partitions are given by A342339.
A000929 counts partitions with adjacent parts x >= 2y.
A002843 counts compositions with adjacent parts x <= 2y.
A224957 counts compositions with x <= 2y and y <= 2x (strict: A342342).
A274199 counts compositions with adjacent parts x < 2y.
A342094 counts partitions with adjacent parts x <= 2y (strict: A342095).
A342096 counts partitions without adjacent x >= 2y (strict: A342097).
A342098 counts partitions with adjacent parts x > 2y.
A342330 counts compositions with x < 2y and y < 2x (strict: A342341).
A342331 counts compositions with adjacent parts x = 2y or y = 2x.
A342332 counts compositions with adjacent parts x > 2y or y > 2x.
A342333 counts compositions with adjacent parts x >= 2y or y >= 2x.
A342335 counts compositions with adjacent parts x >= 2y or y = 2x.
A342338 counts compositions with adjacent parts x < 2y and y <= 2x.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, add(b(n-j, j),
          j=`if`(i=0, 1..n, select(x-> x<=n, [i, 2*i]))))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=0..80);  # Alois P. Heinz, May 24 2021
  • Mathematica
    Table[Length[Select[IntegerPartitions[n],And@@Table[#[[i]]==#[[i-1]]||#[[i-1]]==2*#[[i]],{i,2,Length[#]}]&]],{n,0,30}]
    (* Second program: *)
    b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n - j, j],
         {j, If[i == 0, Range[n], Select[{i, 2i}, # <= n&]]}]];
    a[n_] := b[n, 0];
    a /@ Range[0, 80] (* Jean-François Alcover, Jun 03 2021, after Alois P. Heinz *)

A224957 Number of compositions [p(1), p(2), ..., p(k)] of n such that p(j) <= 2*p(j-1) and p(j-1) <= 2*p(j).

Original entry on oeis.org

1, 1, 2, 4, 6, 11, 19, 31, 54, 92, 154, 266, 454, 771, 1319, 2249, 3834, 6550, 11176, 19069, 32558, 55567, 94838, 161891, 276325, 471659, 805102, 1374234, 2345724, 4004031, 6834605, 11666260, 19913668, 33991462, 58021534, 99039592, 169055094, 288567886, 492569833, 840790082
Offset: 0

Views

Author

Joerg Arndt, Apr 21 2013

Keywords

Examples

			There are a(6) = 19 such compositions of 6:
01:  [ 1 1 1 1 1 1 ]
02:  [ 1 1 1 1 2 ]
03:  [ 1 1 1 2 1 ]
04:  [ 1 1 2 1 1 ]
05:  [ 1 1 2 2 ]
06:  [ 1 2 1 1 1 ]
07:  [ 1 2 1 2 ]
08:  [ 1 2 2 1 ]
09:  [ 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 4 ]
16:  [ 3 2 1 ]
17:  [ 3 3 ]
18:  [ 4 2 ]
19:  [ 6 ]
		

Crossrefs

The case of strict relations is A342330, with strict case A342341.
The strict case is A342342.
A000929 counts partitions with adjacent parts x >= 2y.
A002843 counts compositions with adjacent parts x <= 2y.
A045690 counts sets with maximum n with adjacent elements y < 2x.
A154402 counts partitions with adjacent parts x = 2y.
A274199 counts compositions with adjacent parts x < 2y.
A342094 counts partitions with adjacent parts x <= 2y (strict: A342095).
A342096 counts partitions without adjacent x >= 2y (strict: A342097).
A342098 counts partitions with adjacent parts x > 2y.
A342331 counts compositions with adjacent parts x = 2y or y = 2x.
A342332 counts compositions with adjacent parts x > 2y or y > 2x.
A342333 counts compositions with adjacent parts x >= 2y or y >= 2x.
A342334 counts compositions with adjacent parts x >= 2y or y > 2x.
A342335 counts compositions with adjacent parts x >= 2y or y = 2x.
A342336 counts compositions with adjacent parts x > 2y or y = 2x.
A342337 counts partitions with adjacent parts x = y or x = 2y.
A342338 counts compositions with adjacent parts x < 2y and y <= 2x.
A342340 counts compositions with adjacent x = y or x = 2y or y = 2x.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, add(
          b(n-j, j), j=`if`(i=0, 1..n, ceil(i/2)..min(n, 2*i))))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=0..42);  # Alois P. Heinz, Mar 15 2021
  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],And@@Table[#[[i]]<=2*#[[i-1]]&&#[[i-1]]<=2*#[[i]],{i,2,Length[#]}]&]],{n,15}] (* Gus Wiseman, Mar 12 2021 *)
    b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n - j, j], {j, If[i == 0, Range[n], Range[Ceiling[i/2], Min[n, 2*i]]]}]];
    a[n_] := b[n, 0];
    a /@ Range[0, 42] (* Jean-François Alcover, May 24 2021, after Alois P. Heinz *)

Extensions

Name corrected by Gus Wiseman, Mar 11 2021

A342330 Number of compositions of n with all adjacent parts (x,y) satisfying x < 2y and y < 2x.

Original entry on oeis.org

1, 1, 2, 2, 3, 4, 4, 7, 9, 11, 17, 23, 32, 44, 63, 91, 127, 180, 255, 363, 516, 732, 1044, 1485, 2109, 3002, 4277, 6089, 8660, 12323, 17550, 24986, 35562, 50628, 72084, 102616, 146077, 207980, 296114, 421555, 600153, 854469, 1216543, 1731983, 2465842, 3510713
Offset: 0

Views

Author

Gus Wiseman, Mar 09 2021

Keywords

Comments

Each quotient of adjacent parts is between 1/2 and 2 exclusive.

Examples

			The a(1) = 1 through a(9) = 11 partitions:
  1   2    3     4      5       6        7         8          9
      11   111   22     23      33       34        35         45
                 1111   32      222      43        44         54
                        11111   111111   223       53         234
                                         232       233        333
                                         322       323        432
                                         1111111   332        2223
                                                   2222       2232
                                                   11111111   2322
                                                              3222
                                                              111111111
		

Crossrefs

The version allowing equality is A224957.
The unordered version (partitions) is A342096, with strict case A342097.
Reversing operators and changing 'and' into 'or' gives A342332.
The version allowing partial equality is A342338.
The strict case is A342341.
A000929 counts partitions with all adjacent parts x >= 2y.
A002843 counts compositions with all adjacent parts x <= 2y.
A154402 counts partitions with all adjacent parts x = 2y.
A274199 counts compositions with all adjacent parts x < 2y.
A342094 counts partitions with all adjacent parts x <= 2y (strict: A342095).
A342098 counts partitions with all adjacent parts x > 2y.
A342331 counts compositions where each part is twice or half the prior.
A342335 counts compositions with all adjacent parts x >= 2y or y = 2x.
A342337 counts compositions with all adjacent parts x = y or x = 2y.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, add(b(n-j, j)
          , j=`if`(i=0, 1..n, floor(i/2)+1..min(n, 2*i-1))))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=0..45);  # Alois P. Heinz, Mar 15 2021
  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],And@@Table[#[[i]]<2*#[[i-1]]&&#[[i-1]]<2*#[[i]],{i,2,Length[#]}]&]],{n,0,15}]
    (* Second program: *)
    b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n - j, j], {j, If[i == 0, 1, Floor[i/2] + 1], If[i == 0, n, Min[n, 2i - 1]]}]];
    a[n_] := b[n, 0];
    a /@ Range[0, 45] (* Jean-François Alcover, May 09 2021, after Alois P. Heinz *)
  • PARI
    C(n, pred)={my(M=matid(n)); for(k=1, n, for(i=1, k-1, M[i, k]=sum(j=1, k-i, if(pred(j, i), M[j, k-i], 0)))); sum(q=1, n, M[q, ])}
    seq(n)={concat([1], C(n, (i,j)->i<2*j && j<2*i))} \\ Andrew Howroyd, Mar 13 2021

Extensions

Terms a(31) and beyond from Andrew Howroyd, Mar 13 2021

A114921 Number of unimodal compositions of n+2 where the maximal part appears exactly twice.

Original entry on oeis.org

1, 0, 1, 2, 4, 6, 11, 16, 27, 40, 63, 92, 141, 202, 299, 426, 614, 862, 1222, 1694, 2362, 3242, 4456, 6054, 8229, 11072, 14891, 19872, 26477, 35050, 46320, 60866, 79827, 104194, 135703, 176008, 227791, 293702, 377874, 484554, 620011, 790952, 1006924
Offset: 0

Views

Author

Michael Somos, Jan 07 2006

Keywords

Comments

Old name was: Expansion of a q-series.
a(n) is also the number of 2-colored partitions of n with the same number of parts in each color. - Shishuo Fu, May 30 2017
From Gus Wiseman, Mar 25 2021: (Start)
Also the number of even-length compositions of n with alternating parts weakly decreasing. Allowing odd lengths also gives A342528. The version with alternating parts strictly decreasing appears to be A064428. The a(2) = 1 through a(7) = 16 compositions are:
(1,1) (1,2) (1,3) (1,4) (1,5) (1,6)
(2,1) (2,2) (2,3) (2,4) (2,5)
(3,1) (3,2) (3,3) (3,4)
(1,1,1,1) (4,1) (4,2) (4,3)
(1,2,1,1) (5,1) (5,2)
(2,1,1,1) (1,2,1,2) (6,1)
(1,3,1,1) (1,3,1,2)
(2,1,2,1) (1,4,1,1)
(2,2,1,1) (2,2,1,2)
(3,1,1,1) (2,2,2,1)
(1,1,1,1,1,1) (2,3,1,1)
(3,1,2,1)
(3,2,1,1)
(4,1,1,1)
(1,2,1,1,1,1)
(2,1,1,1,1,1)
(End)

Examples

			From _Joerg Arndt_, Jun 10 2013: (Start)
There are a(7)=16 such compositions of 7+2=9 where the maximal part appears twice:
  01:  [ 1 1 1 1 1 2 2 ]
  02:  [ 1 1 1 1 2 2 1 ]
  03:  [ 1 1 1 2 2 1 1 ]
  04:  [ 1 1 1 3 3 ]
  05:  [ 1 1 2 2 1 1 1 ]
  06:  [ 1 1 3 3 1 ]
  07:  [ 1 2 2 1 1 1 1 ]
  08:  [ 1 2 3 3 ]
  09:  [ 1 3 3 1 1 ]
  10:  [ 1 3 3 2 ]
  11:  [ 1 4 4 ]
  12:  [ 2 2 1 1 1 1 1 ]
  13:  [ 2 3 3 1 ]
  14:  [ 3 3 1 1 1 ]
  15:  [ 3 3 2 1 ]
  16:  [ 4 4 1 ]
(End)
		

Crossrefs

Cf. A226541 (max part appears three times), A188674 (max part m appears m times), A001523 (max part appears any number of times).
Column k=2 of A247255.
A000041 counts weakly increasing (or weakly decreasing) compositions.
A000203 adds up divisors.
A002843 counts compositions with all adjacent parts x <= 2y.
A003242 counts anti-run compositions.
A034008 counts even-length compositions.
A065608 counts even-length compositions with alternating parts equal.
A342528 counts compositions with alternating parts weakly decreasing.
A342532 counts even-length compositions with alternating parts unequal.

Programs

  • Mathematica
    max = 50; s = (1+Sum[2*(-1)^k*q^(k(k+1)/2), {k, 1, max}])/QPochhammer[q]^2+ O[q]^max; CoefficientList[s, q] (* Jean-François Alcover, Nov 30 2015, from 1st g.f. *)
    wdw[q_]:=And@@Table[q[[i]]>=q[[i+2]],{i,Length[q]-2}];
    Table[Length[Select[Join@@Permutations/@Select[IntegerPartitions[n],EvenQ[Length[#]]&],wdw]],{n,0,15}] (* Gus Wiseman, Mar 25 2021 *)
  • PARI
    {a(n) = if( n<0, 0, polcoeff( sum(k=0, n\2, x^(2*k) / prod(i=1, k, 1 - x^i, 1 + x * O(x^n))^2), n))};
    
  • PARI
    {a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( sum(k=1, sqrtint(8*n + 1)\2, 2*(-1)^k * x^((k^2+k)/2), 1 + A) / eta(x + A)^2, n))};

Formula

G.f.: 1 + Sum_{k>0} (x^k / ((1-x)(1-x^2)...(1-x^k)))^2 = (1 + Sum_{k>0} 2 (-1)^k x^((k^2+k)/2) ) / (Product_{k>0} (1 - x^k))^2.
G.f.: 1 + x*(1 - G(0))/(1-x) where G(k) = 1 - x/(1-x^(k+1))^2/(1-x/(x-1/G(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Jan 23 2013
a(n) = A006330(n) - A001523(n). - Vaclav Kotesovec, Jun 22 2015
a(n) ~ Pi * exp(2*Pi*sqrt(n/3)) / (16 * 3^(5/4) * n^(7/4)). - Vaclav Kotesovec, Oct 24 2018

Extensions

New name from Joerg Arndt, Jun 10 2013

A342331 Number of compositions of n where each part after the first is either twice or half the prior part.

Original entry on oeis.org

1, 1, 1, 3, 2, 2, 5, 4, 3, 9, 6, 4, 14, 9, 8, 22, 15, 11, 37, 24, 21, 58, 40, 30, 95, 67, 53, 157, 114, 85, 264, 187, 147, 428, 315, 244, 732, 527, 410, 1207, 892, 681, 2034, 1490, 1155, 3416, 2508, 1927, 5731, 4215, 3259, 9597, 7091, 5454, 16175, 11914, 9194, 27134, 20033, 15425, 45649, 33672, 25967, 76714
Offset: 0

Views

Author

Gus Wiseman, Mar 09 2021

Keywords

Comments

All quotients of adjacent parts are either 1/2 or 2.

Examples

			The a(1) =  1 through a(12) = 14 compositions (A = 10, B = 11, C = 12):
  1  2  3   4    5    6     7      8      9       A        B        C
        12  121  212  24    124    242    36      424      21242    48
        21            42    421    21212  63      12124    24212    84
                      1212  12121         1242    12421    2121212  363
                      2121                2124    42121             2424
                                          2421    1212121           4242
                                          4212                      121242
                                          121212                    124212
                                          212121                    212124
                                                                    212421
                                                                    242121
                                                                    421212
                                                                    12121212
                                                                    21212121
		

Crossrefs

The unordered version (partitions) is A154402.
The version allowing equality is A342340.
A000929 counts partitions with all adjacent parts x >= 2y.
A002843 counts compositions with all adjacent parts x <= 2y.
A224957 counts compositions with all x <= 2y and y <= 2x (strict: A342342).
A274199 counts compositions with all adjacent parts x < 2y.
A342094 counts partitions with all adjacent x <= 2y (strict: A342095).
A342096 counts partitions with no adjacent x >= 2y (strict: A342097).
A342098 counts partitions with all adjacent parts x > 2y.
A342330 counts compositions with all x < 2y and y < 2x (strict: A342341).
A342332 counts compositions with all adjacent parts x > 2y or y > 2x.
A342333 counts compositions with adjacent parts x >= 2y or y >= 2x.
A342335 counts compositions with all adjacent parts x >= 2y or y = 2x.
A342337 counts partitions with all adjacent parts x = y or x = 2y.
A342338 counts compositions with all adjacent parts x < 2y and y <= 2x.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, add(b(n-j, j), j=
         `if`(i=0, 1..n, select(t-> t::integer and t<=n, {2*i, i/2}))))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=0..80);  # Alois P. Heinz, Mar 14 2021
  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],And@@Table[#[[i]]==2*#[[i-1]]||#[[i-1]]==2*#[[i]],{i,2,Length[#]}]&]],{n,0,15}]
    (* Second program: *)
    b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n - j, j], {j, If[i == 0, Range[n], Select[{2i, i/2}, IntegerQ[#] && # <= n &]]}]];
    a[n_] := b[n, 0];
    a /@ Range[0, 80] (* Jean-François Alcover, May 09 2021, after Alois P. Heinz *)
  • PARI
    seq(n)={my(M=matid(n)); for(k=1, n, for(i=1, k-1, M[i, k] = if(i%2==0,M[i/2,k-i]) + if(i*3<=k, M[i*2,k-i]))); concat([1], sum(q=1, n, M[q, ]))} \\ Andrew Howroyd, Mar 13 2021

Extensions

More terms from Joerg Arndt, Mar 12 2021
Showing 1-10 of 34 results. Next