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.

Previous Showing 11-20 of 34 results. Next

A367222 Number of subsets of {1..n} whose cardinality can be written as a nonnegative linear combination of the elements.

Original entry on oeis.org

1, 2, 3, 6, 12, 24, 49, 101, 207, 422, 859, 1747, 3548, 7194, 14565, 29452, 59496, 120086, 242185, 488035, 982672, 1977166, 3975508, 7989147, 16047464, 32221270, 64674453, 129775774, 260337978, 522124197, 1046911594, 2098709858, 4206361369, 8429033614, 16887728757, 33829251009, 67755866536, 135687781793, 271693909435
Offset: 0

Views

Author

Gus Wiseman, Nov 14 2023

Keywords

Examples

			The set {1,2,4} has 3 = (2)+(1) or 3 = (1+1+1) so is counted under a(4).
The a(0) = 1 through a(4) = 12 subsets:
  {}  {}   {}     {}       {}
      {1}  {1}    {1}      {1}
           {1,2}  {1,2}    {1,2}
                  {1,3}    {1,3}
                  {2,3}    {1,4}
                  {1,2,3}  {2,3}
                           {2,4}
                           {1,2,3}
                           {1,2,4}
                           {1,3,4}
                           {2,3,4}
                           {1,2,3,4}
		

Crossrefs

The following sequences count and rank integer partitions and finite sets according to whether their length is a subset-sum or linear combination of the parts. The current sequence is starred.
sum-full sum-free comb-full comb-free
-------------------------------------------
A002865 counts partitions whose length is a part, complement A229816.
A007865/A085489/A151897 count certain types of sum-free subsets.
A088809/A093971/A364534 count certain types of sum-full subsets.
A124506 appears to count combination-free subsets, differences of A326083.
A326020 counts complete subsets.
A365046 counts combination-full subsets, differences of A364914.
Triangles:
A008284 counts partitions by length, strict A008289.
A365381 counts sets with a subset summing to k, without A366320.
A365541 counts subsets containing two distinct elements summing to k.

Programs

  • Mathematica
    combs[n_,y_]:=With[{s=Table[{k,i},{k,y}, {i,0,Floor[n/k]}]}, Select[Tuples[s], Total[Times@@@#]==n&]];
    Table[Length[Select[Subsets[Range[n]], combs[Length[#], Union[#]]!={}&]], {n,0,10}]
  • Python
    from itertools import combinations
    from sympy.utilities.iterables import partitions
    def A367222(n):
        c, mlist = 1, []
        for m in range(1,n+1):
            t = set()
            for p in partitions(m):
                t.add(tuple(sorted(p.keys())))
            mlist.append([set(d) for d in t])
        for k in range(1,n+1):
            for w in combinations(range(1,n+1),k):
                ws = set(w)
                for s in mlist[k-1]:
                    if s <= ws:
                        c += 1
                        break
        return c # Chai Wah Wu, Nov 16 2023

Formula

a(n) = 2^n - A367223(n).

Extensions

a(13)-a(33) from Chai Wah Wu, Nov 15 2023
a(34)-a(38) from Max Alekseyev, Feb 25 2025

A367223 Number of subsets of {1..n} whose cardinality cannot be written as a nonnegative linear combination of the elements.

Original entry on oeis.org

0, 0, 1, 2, 4, 8, 15, 27, 49, 90, 165, 301, 548, 998, 1819, 3316, 6040, 10986, 19959, 36253, 65904, 119986, 218796, 399461, 729752, 1333162, 2434411, 4441954, 8097478, 14746715, 26830230, 48773790, 88605927, 160900978, 292140427, 530487359, 963610200, 1751171679, 3183997509
Offset: 0

Views

Author

Gus Wiseman, Nov 14 2023

Keywords

Examples

			3 cannot be written as a nonnegative linear combination of 2, 4, and 5, so {2,4,5} is counted under a(6).
The a(2) = 1 through a(6) = 15 subsets:
  {2}  {2}  {2}    {2}      {2}
       {3}  {3}    {3}      {3}
            {4}    {4}      {4}
            {3,4}  {5}      {5}
                   {3,4}    {6}
                   {3,5}    {3,4}
                   {4,5}    {3,5}
                   {2,4,5}  {3,6}
                            {4,5}
                            {4,6}
                            {5,6}
                            {2,4,5}
                            {2,4,6}
                            {2,5,6}
                            {4,5,6}
		

Crossrefs

The following sequences count and rank integer partitions and finite sets according to whether their length is a subset-sum or linear combination of the parts. The current sequence is starred.
sum-full sum-free comb-full comb-free
-------------------------------------------
A007865/A085489/A151897 count certain types of sum-free subsets.
A088809/A093971/A364534 count certain types of sum-full subsets.
A124506 appears to count combination-free subsets, differences of A326083.
A365046 counts combination-full subsets, differences of A364914.
Triangles:
A116861 counts positive linear combinations of strict partitions of k.
A364916 counts linear combinations of strict partitions of k.
A366320 counts subsets without a subset summing to k, with A365381.

Programs

  • Mathematica
    combs[n_,y_]:=With[{s=Table[{k,i},{k,y}, {i,0,Floor[n/k]}]}, Select[Tuples[s], Total[Times@@@#]==n&]];
    Table[Length[Select[Subsets[Range[n]], combs[Length[#],Union[#]]=={}&]], {n,0,10}]
  • Python
    from itertools import combinations
    from sympy.utilities.iterables import partitions
    def A367223(n):
        c, mlist = 0, []
        for m in range(1,n+1):
            t = set()
            for p in partitions(m):
                t.add(tuple(sorted(p.keys())))
            mlist.append([set(d) for d in t])
        for k in range(1,n+1):
            for w in combinations(range(1,n+1),k):
                ws = set(w)
                for s in mlist[k-1]:
                    if s <= ws:
                        break
                else:
                    c += 1
        return c # Chai Wah Wu, Nov 16 2023

Formula

a(n) = 2^n - A367222(n).

Extensions

a(14)-a(33) from Chai Wah Wu, Nov 15 2023
a(34)-a(38) from Max Alekseyev, Feb 25 2025

A365544 Number of subsets of {1..n} containing two distinct elements summing to n.

Original entry on oeis.org

0, 0, 0, 2, 4, 14, 28, 74, 148, 350, 700, 1562, 3124, 6734, 13468, 28394, 56788, 117950, 235900, 484922, 969844, 1979054, 3958108, 8034314, 16068628, 32491550, 64983100, 131029082, 262058164, 527304974, 1054609948, 2118785834, 4237571668, 8503841150, 17007682300
Offset: 0

Views

Author

Gus Wiseman, Sep 20 2023

Keywords

Examples

			The a(1) = 0 through a(5) = 14 subsets:
  .  .  {1,2}    {1,3}      {1,4}
        {1,2,3}  {1,2,3}    {2,3}
                 {1,3,4}    {1,2,3}
                 {1,2,3,4}  {1,2,4}
                            {1,3,4}
                            {1,4,5}
                            {2,3,4}
                            {2,3,5}
                            {1,2,3,4}
                            {1,2,3,5}
                            {1,2,4,5}
                            {1,3,4,5}
                            {2,3,4,5}
                            {1,2,3,4,5}
		

Crossrefs

For strict partitions we have A140106 shifted left.
The version for partitions is A004526.
The complement is counted by A068911.
For all subsets of elements we have A365376.
Main diagonal k = n of A365541.
A000009 counts subsets summing to n.
A007865/A085489/A151897 count certain types of sum-free subsets.
A093971/A088809/A364534 count certain types of sum-full subsets.
A365381 counts subsets with a subset summing to k.

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],MemberQ[Total/@Subsets[#,{2}],n]&]],{n,0,10}]
  • Python
    def A365544(n): return (1<>1)<<1 if n&1 else 3**(n-1>>1)<<2) if n else 0 # Chai Wah Wu, Aug 30 2024

Formula

a(n) = 2^n - A068911(n).
From Alois P. Heinz, Aug 30 2024: (Start)
G.f.: 2*x^3/((2*x-1)*(3*x^2-1)).
a(n) = 2 * A167762(n-1) for n>=1. (End)

A167762 a(n) = 2*a(n-1)+3*a(n-2)-6*a(n-3) starting a(0)=a(1)=0, a(2)=1.

Original entry on oeis.org

0, 0, 1, 2, 7, 14, 37, 74, 175, 350, 781, 1562, 3367, 6734, 14197, 28394, 58975, 117950, 242461, 484922, 989527, 1979054, 4017157, 8034314, 16245775, 32491550, 65514541, 131029082, 263652487, 527304974, 1059392917, 2118785834, 4251920575, 8503841150
Offset: 0

Views

Author

Paul Curtz, Nov 11 2009

Keywords

Comments

Inverse binomial transform yields two zeros followed by A077917 (a signed variant of A127864).
a(n) mod 10 is zero followed by a sequence with period length 8: 0, 1, 2, 7, 4, 7, 4, 5 (repeat).
a(n) is the number of length n+1 binary words with some prefix w such that w contains three more 1's than 0's and no prefix of w contains three more 0's than 1's. - Geoffrey Critzer, Dec 13 2013
From Gus Wiseman, Oct 06 2023: (Start)
Also the number of subsets of {1..n} with two distinct elements summing to n + 1. For example, the a(2) = 1 through a(5) = 14 subsets are:
{1,2} {1,3} {1,4} {1,5}
{1,2,3} {2,3} {2,4}
{1,2,3} {1,2,4}
{1,2,4} {1,2,5}
{1,3,4} {1,3,5}
{2,3,4} {1,4,5}
{1,2,3,4} {2,3,4}
{2,4,5}
{1,2,3,4}
{1,2,3,5}
{1,2,4,5}
{1,3,4,5}
{2,3,4,5}
{1,2,3,4,5}
The complement is counted by A038754.
Allowing twins gives A167936, complement A108411.
For n instead of n + 1 we have A365544, complement A068911.
The version for all subsets (not just pairs) is A366130.
(End)

Crossrefs

First differences are A167936, complement A108411.

Programs

  • Mathematica
    LinearRecurrence[{2,3,-6},{0,0,1},40] (* Harvey P. Dale, Sep 17 2013 *)
    CoefficientList[Series[x^2/((2 x - 1) (3 x^2 - 1)), {x, 0, 50}], x] (* Vincenzo Librandi, Sep 17 2013 *)
    Table[Length[Select[Subsets[Range[n]],MemberQ[Total/@Subsets[#,{2}],n+1]&]],{n,0,10}] (* Gus Wiseman, Oct 06 2023 *)

Formula

a(n) mod 9 = A153130(n), n>3 (essentially the same as A154529, A146501 and A029898).
a(n+1)-2*a(n) = 0 if n even, = A000244((1+n)/2) if n odd.
a(2*n) = A005061(n). a(2*n+1) = 2*A005061(n).
G.f.: x^2/((2*x-1)*(3*x^2-1)). a(n) = 2^n - A038754(n). - R. J. Mathar, Nov 12 2009
G.f.: x^2/(1-2*x-3*x^2+6*x^3). - Philippe Deléham, Nov 11 2009

Extensions

Edited and extended by R. J. Mathar, Nov 12 2009

A216216 Square array T, read by antidiagonals: T(n,k) = 0 if n-k>=3 or if k-n>=3, T(2,0) = T(1,0) = T(0,0) = T(0,1) = T(0,2) = 1, T(n,k) = T(n-1,k) + T(n,k-1).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 0, 3, 3, 0, 0, 3, 6, 3, 0, 0, 0, 9, 9, 0, 0, 0, 0, 9, 18, 9, 0, 0, 0, 0, 0, 27, 27, 0, 0, 0, 0, 0, 0, 27, 54, 27, 0, 0, 0, 0, 0, 0, 0, 81, 81, 0, 0, 0, 0, 0, 0, 0, 0, 81, 162, 81, 0, 0, 0, 0
Offset: 0

Views

Author

Philippe Deléham, Mar 13 2013

Keywords

Examples

			Square array begins:
1, 1, 1,  0,  0,   0,   0,   0, 0, ... n = 0
1, 2, 3,  3,  0,   0,   0,   0, 0, ... n = 1
1, 3, 6,  9,  9,   0,   0,   0, 0, ... n = 2
0, 3, 9, 18, 27,  27,   0,   0, 0, ... n = 3
0, 0, 9, 27, 54,  81,  81,   0, 0, ... n = 4
0, 0, 0, 27, 81, 162, 243, 243, 0, ... n = 5
....
		

Crossrefs

Formula

T(n,n) = A025192(n).
T(n+1,n) = T(n+2,n) = T(n,n+1) = T(n,n+2) = 3^n = A000244(n).
Sum_{k, 0<=k<=n} T(n-k,k) = A068911(n).

A048328 Numbers that are repdigits in base 3.

Original entry on oeis.org

0, 1, 2, 4, 8, 13, 26, 40, 80, 121, 242, 364, 728, 1093, 2186, 3280, 6560, 9841, 19682, 29524, 59048, 88573, 177146, 265720, 531440, 797161, 1594322, 2391484, 4782968, 7174453, 14348906, 21523360, 43046720, 64570081, 129140162, 193710244, 387420488, 581130733
Offset: 0

Views

Author

Patrick De Geest, Feb 15 1999

Keywords

Comments

Case for base 2 see A000225: 2^n - 1.
If the sequence b(n) represents the number of paths of length n, n >= 1, starting at node 1 and ending at nodes 1, 2, 3 and 4 on the path graph P_5 then a(n-1) = b(n) - 1. - Johannes W. Meijer, May 29 2010

Crossrefs

Programs

  • Maple
    nmax := 35; a(0) := 0: for n from 1 to nmax do a(2*n) := a(2*n-2) + 2*3^(n-1); od: a(1) := 1: for n from 1 to nmax do a(2*n+1) := 1*a(2*n-1) + 3^n; od: seq(a(n), n=0..nmax);
    # End program 1
    with(GraphTheory): G := PathGraph(5): A:= AdjacencyMatrix(G): nmax := nmax; for n from 1 to nmax+1 do B(n) := A^n; b(n) := add(B(n)[1, k], k=1..4); a1(n-1) := b(n)-1; od: seq(a1(n), n=0..nmax);
    # End program 2
    # From Johannes W. Meijer, May 29 2010, revised Sep 23 2012
    # third Maple program:
    a:= n->(<<0|1>, <-3|4>>^iquo(n, 2, 'r').`if`(r=0, <<0, 2>>, <<1, 4>>))[1, 1]:
    seq (a(n), n=0..60);  # Alois P. Heinz, Sep 23 2012
  • Mathematica
    Rest[FromDigits[#, 3]&/@Flatten[Table[{PadRight[{1}, n, 1], PadRight[{2}, n, 2]}, {n, 0, 20}], 1]] (* Harvey P. Dale, Feb 03 2011 *)
  • PARI
    a(n)=([0,1,0,0; 0,0,1,0; 0,0,0,1; -3,0,4,0]^n*[0;1;2;4])[1,1] \\ Charles R Greathouse IV, Oct 07 2015

Formula

G.f.: (2*x^2+x)/(1-4*x^2+3*x^4). - Alois P. Heinz, Sep 23 2012
Sum_{n>=1} 1/a(n) = 3 * A214369 = 2.04646050781571420028... - Amiram Eldar, Jan 21 2022
a(n) = (3^(n/2)*(sqrt(3) + 2 - (-1)^n*(sqrt(3) - 2)) - 3 - (-1)^n)/4. - Stefano Spezia, Feb 18 2022

A068913 Square array read by antidiagonals of number of k step walks (each step +-1 starting from 0) which are never more than n or less than -n.

Original entry on oeis.org

1, 0, 1, 0, 2, 1, 0, 2, 2, 1, 0, 4, 4, 2, 1, 0, 4, 6, 4, 2, 1, 0, 8, 12, 8, 4, 2, 1, 0, 8, 18, 14, 8, 4, 2, 1, 0, 16, 36, 28, 16, 8, 4, 2, 1, 0, 16, 54, 48, 30, 16, 8, 4, 2, 1, 0, 32, 108, 96, 60, 32, 16, 8, 4, 2, 1, 0, 32, 162, 164, 110, 62, 32, 16, 8, 4, 2, 1, 0, 64, 324, 328, 220, 124, 64, 32, 16, 8, 4, 2, 1
Offset: 0

Views

Author

Henry Bottomley, Mar 06 2002

Keywords

Examples

			Rows start:
  1,  0,  0,  0,  0, ...
  1,  2,  2,  4,  4, ...
  1,  2,  4,  6, 12, ...
  1,  2,  4,  8, 14, ...
  ...
		

Crossrefs

Cf. early rows: A000007, A016116 (without initial term), A068911, A068912, A216212, A216241, A235701.
Central and lower diagonals are A000079, higher diagonals include A000918, A028399.

Programs

  • Mathematica
    T[n_,0]=1; T[n_,k_]:=2^k/(n+1) Sum[(-1)^r Cos[(Pi (2r-1))/(2 (n+1))]^k Cot[(Pi (1-2r))/(4 (n+1))],{r,1,n+1}]; Table[T[r,n-r],{n,0,20},{r,0,n}]//Round//Flatten (* Herbert Kociemba, Sep 23 2020 *)

Formula

Starting with T(n, 0) = 1, if (k-n) is negative or even then T(n, k) = 2*T(n, k-1), otherwise T(n, k) = 2*T(n, k-1) - A061897(n+1, (k-n-1)/2). So for n>=k, T(n, k) = 2^k. [Corrected by Sean A. Irvine, Mar 23 2024]
T(n,0) = 1, T(n,k) = (2^k/(n+1))*Sum_{r=1..n+1} (-1)^r*cos((Pi*(2*r-1))/(2*(n+1)))^k*cot((Pi*(1-2*r))/(4*(n+1))). - Herbert Kociemba, Sep 23 2020

A117855 Number of nonzero palindromes of length n (in base 3).

Original entry on oeis.org

2, 2, 6, 6, 18, 18, 54, 54, 162, 162, 486, 486, 1458, 1458, 4374, 4374, 13122, 13122, 39366, 39366, 118098, 118098, 354294, 354294, 1062882, 1062882, 3188646, 3188646, 9565938, 9565938, 28697814, 28697814, 86093442, 86093442, 258280326, 258280326, 774840978
Offset: 1

Views

Author

Martin Renner, May 02 2006

Keywords

Comments

See A225367 for the sequence that counts all base 3 palindromes, including 0 (and thus also the number of n-digit terms in A006072). -- A nonzero palindrome of length L=2k-1 or of length L=2k is determined by the first k digits, which then determine the last k digits by symmetry. Since the first digit cannot be 0, there are 2*3^(k-1) possibilities. - M. F. Hasler, May 05 2013
From Gus Wiseman, Oct 18 2023: (Start)
Also the number of subsets of {1..n} with n not the sum of two subset elements (possibly the same). For example, the a(0) = 1 through a(4) = 6 subsets are:
{} {} {} {} {}
{1} {2} {1} {1}
{2} {3}
{3} {4}
{1,3} {1,4}
{2,3} {3,4}
For subsets with no subset summing to n we have A365377.
Requiring pairs to be distinct gives A068911, complement A365544.
The complement is counted by A366131.
(End) [Edited by Peter Munn, Nov 22 2023]

Examples

			The a(3)=6 palindromes of length 3 are: 101, 111, 121, 202, 212, and 222. - _M. F. Hasler_, May 05 2013
		

Crossrefs

Cf. A050683 and A070252.
Bisections are both A025192.
A093971/A088809/A364534 count certain types of sum-full subsets.
A108411 lists powers of 3 repeated, complement A167936.

Programs

  • Mathematica
    With[{c=NestList[3#&,2,20]},Riffle[c,c]] (* Harvey P. Dale, Mar 25 2018 *)
    Table[Length[Select[Subsets[Range[n]],!MemberQ[Total/@Tuples[#,2],n]&]],{n,0,10}] (* Gus Wiseman, Oct 18 2023 *)
  • PARI
    A117855(n)=2*3^((n-1)\2) \\ - M. F. Hasler, May 05 2013
    
  • Python
    def A117855(n): return 3**(n-1>>1)<<1 # Chai Wah Wu, Oct 28 2024

Formula

a(n) = 2*3^floor((n-1)/2).
a(n) = 2*A108411(n-1).
From Colin Barker, Feb 15 2013: (Start)
a(n) = 3*a(n-2).
G.f.: -2*x*(x+1)/(3*x^2-1). (End)

Extensions

More terms from Colin Barker, Feb 15 2013

A078038 Expansion of (1-x)/(1+x-2*x^2-x^3).

Original entry on oeis.org

1, -2, 4, -7, 13, -23, 42, -75, 136, -244, 441, -793, 1431, -2576, 4645, -8366, 15080, -27167, 48961, -88215, 158970, -286439, 516164, -930072, 1675961, -3019941, 5441791, -9805712, 17669353, -31838986, 57371980, -103380599, 186285573, -335674791, 604865338, -1089929347, 1963985232
Offset: 0

Views

Author

N. J. A. Sloane, Nov 17 2002

Keywords

Comments

From Johannes W. Meijer, May 29 2010: (Start)
The absolute values of the a(n) represent the number of ways White can force checkmate in exactly (n+1) moves, n>=0, ignoring the fifty-move and the triple repetition rules, in the following chess position: White Ka1, Ra8, Bc1, Nb8, pawns a6, a7, b2, c6, d2, f6 and h6; Black Ke8, pawns b3, c7, d3, f7 and h7. (After Noam D. Elkies, see link; diagram 5).
The absolute values of the a(n) represent all paths of length n starting at the third (or fourth) node on the path graph P_6, see the Maple program.
(End)
For n>=1, abs(a(n-1)) is the number of compositions where there is no rise between every second pair of parts, starting with the second and third part; see example. Also, abs(a(n-1)) is the number of compositions of n where there is no fall between every second pair of parts, starting with the second and third part; see example. [Joerg Arndt, May 21 2013]

Examples

			From _Joerg Arndt_, May 21 2013: (Start)
There are abs(a(6-1))=23 compositions of 6 where there is no rise between every second pair of parts:
          v   v    <--= no rise over these positions
01:  [ 1 1 1 1 1 1 ]
02:  [ 1 1 1 2 1 ]
03:  [ 1 1 1 3 ]
04:  [ 1 2 1 1 1 ]
05:  [ 1 2 1 2 ]
06:  [ 1 2 2 1 ]
07:  [ 1 3 1 1 ]
08:  [ 1 3 2 ]
09:  [ 1 4 1 ]
10:  [ 1 5 ]
11:  [ 2 1 1 1 1 ]
12:  [ 2 1 1 2 ]
13:  [ 2 2 1 1 ]
14:  [ 2 2 2 ]
15:  [ 2 3 1 ]
16:  [ 2 4 ]
17:  [ 3 1 1 1 ]
18:  [ 3 2 1 ]
19:  [ 3 3 ]
20:  [ 4 1 1 ]
21:  [ 4 2 ]
22:  [ 5 1 ]
23:  [ 6 ]
There are abs(a(6-1))=23 compositions of 6 where there is no fall between every second pair of parts, starting with the second and third part:
          v   v    <--= no fall over these positions
01:  [ 1 1 1 1 1 1 ]
02:  [ 1 1 1 1 2 ]
03:  [ 1 1 1 3 ]
04:  [ 1 1 2 1 1 ]
05:  [ 1 1 2 2 ]
06:  [ 1 1 3 1 ]
07:  [ 1 1 4 ]
08:  [ 1 2 2 1 ]
09:  [ 1 2 3 ]
10:  [ 1 5 ]
11:  [ 2 1 1 1 1 ]
12:  [ 2 1 1 2 ]
13:  [ 2 1 2 1 ]
14:  [ 2 1 3 ]
15:  [ 2 2 2 ]
16:  [ 2 4 ]
17:  [ 3 1 1 1 ]
18:  [ 3 1 2 ]
19:  [ 3 3 ]
20:  [ 4 1 1 ]
21:  [ 4 2 ]
22:  [ 5 1 ]
23:  [ 6 ]
(End)
		

Crossrefs

Cf. A028495, A068911, A094790, A287381 (absolute values).

Programs

  • Maple
    with(GraphTheory): G:= PathGraph(6): A:=AdjacencyMatrix(G): nmax:=36; for n from 0 to nmax do B(n):=A^n; a(n):=add(B(n)[3,k], k=1..6) od: seq(a(n), n=0..nmax); # Johannes W. Meijer, May 29 2010
  • Mathematica
    LinearRecurrence[{-1, 2, 1}, {1, -2, 4}, 40] (* Jean-François Alcover, Jan 08 2019 *)
    a[n_]:=Sum[(-(-2)^(n+1)Cos[(Pi r)/7]^n Cot[(Pi r)/14]Sin[(3Pi r)/7])/7,{r,1,5,2}]
    Table[a[n],{n,0,40}]//Round (* Herbert Kociemba, Sep 17 2020 *)
  • PARI
    Vec((1-x)/(1+x-2*x^2-x^3)+O(x^99)) \\ Charles R Greathouse IV, Sep 25 2012

Formula

a(n+3) = -a(n+2)+2*a(n+1)+a(n), a(0)=1, a(1)=-2, a(2)=4. - Wouter Meeussen, Jan 02 2005
a(n) = (-1)^n * (A006053(n+1) + A006053(n+2)). G.f. of |a(n)|: (1+x)/(x^3 - 2*x^2 - x + 1). - Ralf Stephan, Aug 19 2013
a(n) = Sum_{r=1..6} ((-2)^n*(1-(-1)^r)*cos(Pi*r/7)^n*cot(Pi*r/14)*sin(3*Pi*r/7))/7. - Herbert Kociemba, Sep 17 2020

A365659 Number of strict integer partitions of n that either have (1) length 2, or (2) greatest part n/2.

Original entry on oeis.org

0, 0, 0, 1, 1, 2, 3, 3, 4, 4, 6, 5, 8, 6, 10, 7, 12, 8, 15, 9, 18, 10, 21, 11, 25, 12, 29, 13, 34, 14, 40, 15, 46, 16, 53, 17, 62, 18, 71, 19, 82, 20, 95, 21, 109, 22, 125, 23, 144, 24, 165, 25, 189, 26, 217, 27, 248, 28, 283, 29, 324
Offset: 0

Views

Author

Gus Wiseman, Sep 16 2023

Keywords

Comments

Also the number of strict integer partitions of n containing two possibly equal elements summing to n.

Examples

			The a(3) = 1 through a(11) = 5 partitions:
  (2,1)  (3,1)  (3,2)  (4,2)    (4,3)  (5,3)    (5,4)  (6,4)    (6,5)
                (4,1)  (5,1)    (5,2)  (6,2)    (6,3)  (7,3)    (7,4)
                       (3,2,1)  (6,1)  (7,1)    (7,2)  (8,2)    (8,3)
                                       (4,3,1)  (8,1)  (9,1)    (9,2)
                                                       (5,3,2)  (10,1)
                                                       (5,4,1)
		

Crossrefs

Without repeated parts we have A140106.
The non-strict version is A238628.
For subsets instead of strict partitions we have A365544.
A000009 counts subsets summing to n.
A365046 counts combination-full subsets, differences of A364914.
A365543 counts partitions of n with a submultiset summing to k.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n], UnsameQ@@#&&(Length[#]==2||Max@@#==n/2)&]], {n,0,30}]
  • Python
    from sympy.utilities.iterables import partitions
    def A365659(n): return n>>1 if n&1 or n==0 else (m:=n>>1)+sum(1 for p in partitions(m) if max(p.values(),default=1)==1)-2 # Chai Wah Wu, Sep 18 2023

Formula

a(n) = (n-1)/2 if n is odd. a(n) = n/2 + A000009(n/2) - 2 if n is even and n > 0. - Chai Wah Wu, Sep 18 2023
Previous Showing 11-20 of 34 results. Next