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-19 of 19 results.

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

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

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

A366131 Number of subsets of {1..n} with two elements (possibly the same) summing to n.

Original entry on oeis.org

0, 0, 2, 2, 10, 14, 46, 74, 202, 350, 862, 1562, 3610, 6734, 14926, 28394, 61162, 117950, 249022, 484922, 1009210, 1979054, 4076206, 8034314, 16422922, 32491550, 66045982, 131029082, 265246810, 527304974, 1064175886, 2118785834, 4266269482, 8503841150, 17093775742, 34101458042, 68461196410, 136664112494
Offset: 0

Views

Author

Gus Wiseman, Oct 07 2023

Keywords

Examples

			The a(0) = 0 through a(5) = 14 subsets:
  .  .  {1}    {1,2}    {2}        {1,4}
        {1,2}  {1,2,3}  {1,2}      {2,3}
                        {1,3}      {1,2,3}
                        {2,3}      {1,2,4}
                        {2,4}      {1,3,4}
                        {1,2,3}    {1,4,5}
                        {1,2,4}    {2,3,4}
                        {1,3,4}    {2,3,5}
                        {2,3,4}    {1,2,3,4}
                        {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

The complement is counted by A117855.
For pairs summing to n + 1 we have A167936.
A068911 counts subsets of {1..n} w/o two distinct elements summing to n.
A093971/A088809/A364534 count certain types of sum-full subsets.

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],MemberQ[Total/@Tuples[#,2],n]&]],{n,0,10}]
  • Python
    def A366131(n): return (1<>1)<<1) if n else 0 # Chai Wah Wu, Nov 14 2023

Formula

From Chai Wah Wu, Nov 14 2023: (Start)
a(n) = 2*a(n-1) + 3*a(n-2) - 6*a(n-3) for n > 3.
G.f.: 2*x^2*(1 - x)/((2*x - 1)*(3*x^2 - 1)). (End)

A366130 Number of subsets of {1..n} with a subset summing to n + 1.

Original entry on oeis.org

0, 0, 1, 2, 7, 15, 38, 79, 184, 378, 823, 1682, 3552, 7208, 14948, 30154, 61698, 124302, 252125, 506521, 1022768, 2051555, 4127633, 8272147, 16607469, 33258510, 66680774, 133467385, 267349211, 535007304, 1071020315, 2142778192, 4288207796
Offset: 0

Views

Author

Gus Wiseman, Oct 07 2023

Keywords

Examples

			The subset S = {1,2,4} has subset {1,4} with sum 4+1 and {2,4} with sum 5+1 and {1,2,4} with sum 6+1, so S is counted under a(4), a(5), and a(6).
The a(0) = 0 through a(5) = 15 subsets:
  .  .  {1,2}  {1,3}    {1,4}      {1,5}
               {1,2,3}  {2,3}      {2,4}
                        {1,2,3}    {1,2,3}
                        {1,2,4}    {1,2,4}
                        {1,3,4}    {1,2,5}
                        {2,3,4}    {1,3,5}
                        {1,2,3,4}  {1,4,5}
                                   {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}
		

Crossrefs

For pairs summing to n + 1 we have A167762, complement A038754.
For n instead of n + 1 we have A365376, for pairs summing to n A365544.
The complement is counted by A365377 shifted.
The complement for pairs summing to n is counted by A365377.
A068911 counts subsets of {1..n} w/o two distinct elements summing to n.
A093971/A088809/A364534 count certain types of sum-full subsets.

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],MemberQ[Total/@Subsets[#],n+1]&]],{n,0,10}]
  • Python
    from itertools import combinations
    from sympy.utilities.iterables import partitions
    def A366130(n):
        a = tuple(set(p.keys()) for p in partitions(n+1,k=n) if max(p.values(),default=0)==1)
        return sum(1 for k in range(2,n+1) for w in (set(d) for d in combinations(range(1,n+1),k)) if any(s<=w for s in a)) # Chai Wah Wu, Nov 24 2023

Formula

Diagonal k = n + 1 of A365381.

Extensions

a(20)-a(32) from Chai Wah Wu, Nov 24 2023

A365383 Triangle read by rows where T(n,k) is the number of integer partitions of n that can be linearly combined with nonnegative coefficients to obtain k.

Original entry on oeis.org

1, 2, 1, 3, 2, 2, 5, 3, 4, 3, 7, 5, 6, 6, 6, 11, 7, 9, 8, 9, 7, 15, 11, 13, 13, 14, 13, 14, 22, 15, 19, 17, 20, 17, 20, 16, 30, 22, 26, 26, 27, 26, 28, 26, 27, 42, 30, 37, 34, 39, 33, 40, 34, 39, 34, 56, 42, 50, 49, 52, 50, 54, 51, 54, 53, 53
Offset: 0

Views

Author

Gus Wiseman, Sep 08 2023

Keywords

Comments

Conjecture: The rows eventually become periodic with period n if extended further. For example, row n = 8 begins:
22, 15, 19, 17, 20, 17, 20, 16,
22, 17, 20, 17, 21, 17, 20, 17,
22, 17, 20, 17, 21, 17, 20, 17, ...

Examples

			Triangle begins:
   1
   2   1
   3   2   2
   5   3   4   3
   7   5   6   6   6
  11   7   9   8   9   7
  15  11  13  13  14  13  14
  22  15  19  17  20  17  20  16
  30  22  26  26  27  26  28  26  27
  42  30  37  34  39  33  40  34  39  34
  56  42  50  49  52  50  54  51  54  53  53
  77  56  68  64  71  63  73  63  71  65  70  62
 101  77  91  89  95  90  97  93  97  97  98  94  99
 135 101 122 115 127 115 130 114 131 119 130 117 132 116
 176 135 159 156 165 157 170 161 167 168 166 165 172 164 166
Row n = 6 counts the following partitions:
  (6)       (51)      (51)      (51)      (51)      (51)
  (51)      (411)     (42)      (411)     (42)      (411)
  (42)      (321)     (411)     (33)      (411)     (321)
  (411)     (3111)    (321)     (321)     (321)     (3111)
  (33)      (2211)    (3111)    (3111)    (3111)    (2211)
  (321)     (21111)   (222)     (2211)    (222)     (21111)
  (3111)    (111111)  (2211)    (21111)   (2211)    (111111)
  (222)               (21111)   (111111)  (21111)
  (2211)              (111111)            (111111)
  (21111)
  (111111)
		

Crossrefs

Column k = 0 is A000041, strict A000009.
The version for subsets is A365381, main diagonal A365376.
A000041 counts integer partitions, strict A000009.
A008284 counts partitions by length, strict A008289.
A116861 and A364916 count linear combinations of strict partitions.
A364350 counts combination-free strict partitions, non-strict A364915.
A364839 counts combination-full strict partitions, non-strict A364913.

Programs

  • Mathematica
    combu[n_,y_]:=With[{s=Table[{k,i},{k,Union[y]},{i,0,Floor[n/k]}]},Select[Tuples[s],Total[Times@@@#]==n&]];
    Table[Length[Select[IntegerPartitions[n],combu[k,#]!={}&]],{n,0,12},{k,0,n-1}]

A365660 Number of integer partitions of 2n with exactly n distinct sums of nonempty submultisets.

Original entry on oeis.org

1, 1, 1, 3, 2, 6, 6, 16, 12, 20, 26, 59, 45, 79, 94, 186, 142, 231, 244, 442, 470, 616, 746, 1340, 1053, 1548, 1852, 2780, 2826, 3874, 4320, 6617, 6286, 7924, 9178, 13180, 13634, 17494, 20356, 28220, 29176, 37188, 41932, 56037
Offset: 0

Views

Author

Gus Wiseman, Sep 16 2023

Keywords

Comments

Are n = 1, 2, 4 the only n such that none of these partitions has 1?
Are n = 2, 4, 5, 8, 9 the only n such that none of these partitions is strict?

Examples

			The partition (433) has sums 3, 4, 6, 7, 10 so is counted under a(5).
The a(1) = 1 through a(7) = 16 partitions:
(2)  (2,2)  (4,2)    (4,2,2)    (4,3,3)      (6,4,2)        (6,5,3)
            (5,1)    (2,2,2,2)  (4,4,2)      (6,5,1)        (8,4,2)
            (2,2,2)             (6,2,2)      (4,4,2,2)      (8,5,1)
                                (8,1,1)      (6,2,2,2)      (9,3,2)
                                (4,2,2,2)    (4,2,2,2,2)    (9,4,1)
                                (2,2,2,2,2)  (2,2,2,2,2,2)  (10,3,1)
                                                            (11,2,1)
                                                            (4,4,4,2)
                                                            (5,3,3,3)
                                                            (6,4,2,2)
                                                            (8,2,2,2)
                                                            (11,1,1,1)
                                                            (4,4,2,2,2)
                                                            (6,2,2,2,2)
                                                            (4,2,2,2,2,2)
                                                            (2,2,2,2,2,2,2)
		

Crossrefs

For n instead of 2n we have A126796.
Central column n = 2k of A365658.
A000009 counts subsets summing to n.
A000124 counts distinct possible sums of subsets of {1..n}.
A002219 counts partitions of 2n with a submultiset summing to n.
A046663 counts partitions of n w/o a submultiset of sum k, strict A365663.
A122768 counts distinct nonempty submultisets of partitions.
A299701 counts sums of submultisets of prime indices, of partitions A304792.
A364272 counts sum-full strict partitions, sum-free A364349.
A365543 counts partitions of n w/ a submultiset of sum k, strict A365661.

Programs

  • Mathematica
    msubs[y_]:=primeMS/@Divisors[Times@@Prime/@y];
    Table[Length[Select[IntegerPartitions[2n], Length[Union[Total/@Rest[msubs[#]]]]==n&]],{n,0,10}]
  • Python
    from collections import Counter
    from sympy.utilities.iterables import partitions, multiset_combinations
    def A365660(n):
        c = 0
        for p in partitions(n<<1):
            q, s = list(Counter(p).elements()), set()
            for l in range(1,len(q)+1):
                for k in multiset_combinations(q,l):
                    s.add(sum(k))
                    if len(s) > n:
                        break
                else:
                    continue
                break
            if len(s)==n:
                c += 1
        return c # Chai Wah Wu, Sep 20 2023

Extensions

a(21)-a(38) from Chai Wah Wu, Sep 20 2023
a(39)-a(43) from Chai Wah Wu, Sep 21 2023

A365826 Number of strict integer partitions of n that are not of length 2 and do not contain n/2.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 2, 2, 4, 4, 7, 7, 12, 12, 20, 20, 30, 31, 45, 46, 66, 68, 93, 97, 130, 136, 179, 188, 242, 256, 325, 344, 432, 459, 568, 606, 742, 793, 963, 1031, 1240, 1331, 1589, 1707, 2026, 2179, 2567, 2766, 3240, 3493, 4072, 4393, 5094, 5501, 6351
Offset: 0

Views

Author

Gus Wiseman, Sep 20 2023

Keywords

Comments

Also the number of strict integer partitions of n without two parts (allowing parts to be re-used) summing to n.

Examples

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

Crossrefs

The second condition alone has bisections A078408 and A365828.
The complement is counted by A365659.
The non-strict version is A365825, complement A238628.
The first condition alone is A365827, complement A140106.
A000041 counts integer partitions, strict A000009.
A182616 counts partitions of 2n that do not contain n, strict A365828.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n], UnsameQ@@#&&FreeQ[Total/@Tuples[#,2],n]&]], {n,0,30}]
Previous Showing 11-19 of 19 results.