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

A143823 Number of subsets {x(1),x(2),...,x(k)} of {1,2,...,n} such that all differences |x(i)-x(j)| are distinct.

Original entry on oeis.org

1, 2, 4, 7, 13, 22, 36, 57, 91, 140, 216, 317, 463, 668, 962, 1359, 1919, 2666, 3694, 5035, 6845, 9188, 12366, 16417, 21787, 28708, 37722, 49083, 63921, 82640, 106722, 136675, 174895, 222558, 283108, 357727, 451575, 567536, 712856, 890405, 1112081, 1382416, 1717540
Offset: 0

Views

Author

John W. Layman, Sep 02 2008

Keywords

Comments

When the set {x(1),x(2),...,x(k)} satisfies the property that all differences |x(i)-x(j)| are distinct (or alternately, all the sums are distinct), then it is called a Sidon set. So this sequence is basically the number of Sidon subsets of {1,2,...,n}. - Sayan Dutta, Feb 15 2024
See A143824 for sizes of the largest subsets of {1,2,...,n} with the desired property.
Also the number of subsets of {1..n} such that every orderless pair of (not necessarily distinct) elements has a different sum. - Gus Wiseman, Jun 07 2019

Examples

			{1,2,4} is a subset of {1,2,3,4}, with distinct differences 2-1=1, 4-1=3, 4-2=2 between pairs of elements, so {1,2,4} is counted as one of the 13 subsets of {1,2,3,4} with the desired property.  Only 2^4-13=3 subsets of {1,2,3,4} do not have this property: {1,2,3}, {2,3,4}, {1,2,3,4}.
From _Gus Wiseman_, May 17 2019: (Start)
The a(0) = 1 through a(5) = 22 subsets:
  {}  {}   {}     {}     {}       {}
      {1}  {1}    {1}    {1}      {1}
           {2}    {2}    {2}      {2}
           {1,2}  {3}    {3}      {3}
                  {1,2}  {4}      {4}
                  {1,3}  {1,2}    {5}
                  {2,3}  {1,3}    {1,2}
                         {1,4}    {1,3}
                         {2,3}    {1,4}
                         {2,4}    {1,5}
                         {3,4}    {2,3}
                         {1,2,4}  {2,4}
                         {1,3,4}  {2,5}
                                  {3,4}
                                  {3,5}
                                  {4,5}
                                  {1,2,4}
                                  {1,2,5}
                                  {1,3,4}
                                  {1,4,5}
                                  {2,3,5}
                                  {2,4,5}
(End)
		

Crossrefs

First differences are A308251.
Second differences are A169942.
Row sums of A381476.
The maximal case is A325879.
The integer partition case is A325858.
The strict integer partition case is A325876.
Heinz numbers of the counterexamples are given by A325992.

Programs

  • Maple
    b:= proc(n, s) local sn, m;
          if n<1 then 1
        else sn:= [s[], n];
             m:= nops(sn);
             `if`(m*(m-1)/2 = nops(({seq(seq(sn[i]-sn[j],
               j=i+1..m), i=1..m-1)})), b(n-1, sn), 0) +b(n-1, s)
          fi
        end:
    a:= proc(n) option remember;
           b(n-1, [n]) +`if`(n=0, 0, a(n-1))
        end:
    seq(a(n), n=0..30);  # Alois P. Heinz, Sep 14 2011
  • Mathematica
    b[n_, s_] := Module[{ sn, m}, If[n<1, 1, sn = Append[s, n]; m = Length[sn]; If[m*(m-1)/2 == Length[Table[sn[[i]] - sn[[j]], {i, 1, m-1}, {j, i+1, m}] // Flatten // Union], b[n-1, sn], 0] + b[n-1, s]]]; a[n_] := a[n] = b[n - 1, {n}] + If[n == 0, 0, a[n-1]]; Table [a[n], {n, 0, 30}] (* Jean-François Alcover, Nov 08 2015, after Alois P. Heinz *)
    Table[Length[Select[Subsets[Range[n]],UnsameQ@@Abs[Subtract@@@Subsets[#,{2}]]&]],{n,0,15}] (* Gus Wiseman, May 17 2019 *)
  • Python
    from itertools import combinations
    def is_sidon_set(s):
        allsums = []
        for i in range(len(s)):
            for j in range(i, len(s)):
                allsums.append(s[i] + s[j])
        if len(allsums)==len(set(allsums)):
            return True
        return False
    def a(n):
        sidon_count = 0
        for r in range(n + 1):
            subsets = combinations(range(1, n + 1), r)
            for subset in subsets:
                if is_sidon_set(subset):
                    sidon_count += 1
        return sidon_count
    print([a(n) for n in range(20)]) # Sayan Dutta, Feb 15 2024
    
  • Python
    from functools import cache
    def b(n, s):
        if n < 1: return 1
        sn = s + [n]
        m = len(sn)
        return (b(n-1, sn) if m*(m-1)//2 == len(set(sn[i]-sn[j] for i in range(m-1) for j in range(i+1, m))) else 0) + b(n-1, s)
    @cache
    def a(n): return b(n-1, [n]) + (0 if n==0 else a(n-1))
    print([a(n) for n in range(31)]) # Michael S. Branicky, Feb 15 2024 after Alois P. Heinz

Formula

a(n) = A169947(n-1) + n + 1 for n>=2. - Nathaniel Johnston, Nov 12 2010
a(n) = A054578(n) + 1 for n>0. - Alois P. Heinz, Jan 17 2013

Extensions

a(21)-a(29) from Nathaniel Johnston, Nov 12 2010
Corrected a(21)-a(29) and more terms from Alois P. Heinz, Sep 14 2011

A325858 Number of Golomb partitions of n.

Original entry on oeis.org

1, 1, 2, 3, 5, 7, 10, 14, 20, 25, 36, 47, 59, 78, 99, 122, 155, 195, 232, 295, 355, 432, 522, 641, 749, 919, 1076, 1283, 1506, 1802, 2067, 2470, 2835, 3322, 3815, 4496, 5070, 5959, 6736, 7807, 8849, 10266, 11499, 13326, 14928, 17140, 19193, 22037, 24519, 28106
Offset: 0

Views

Author

Gus Wiseman, Jun 02 2019

Keywords

Comments

We define a Golomb partition of n to be an integer partition of n such that every pair of distinct parts has a different difference.
Also the number of integer partitions of n such that every orderless pair of (not necessarily distinct) parts has a different sum.
The strict case is A325876.

Examples

			The a(1) = 1 through a(7) = 14 partitions:
  (1)  (2)   (3)    (4)     (5)      (6)       (7)
       (11)  (21)   (22)    (32)     (33)      (43)
             (111)  (31)    (41)     (42)      (52)
                    (211)   (221)    (51)      (61)
                    (1111)  (311)    (222)     (322)
                            (2111)   (411)     (331)
                            (11111)  (2211)    (421)
                                     (3111)    (511)
                                     (21111)   (2221)
                                     (111111)  (4111)
                                               (22111)
                                               (31111)
                                               (211111)
                                               (1111111)
The A000041(9) - a(9) = 5 non-Golomb partitions of 9 are: (531), (432), (3321), (32211), (321111).
		

Crossrefs

The subset case is A143823.
The maximal case is A325879.
The integer partition case is A325858.
The strict integer partition case is A325876.
Heinz numbers of the counterexamples are given by A325992.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n],UnsameQ@@Subtract@@@Subsets[Union[#],{2}]&]],{n,0,30}]

A325864 Number of subsets of {1..n} of which every subset has a different sum.

Original entry on oeis.org

1, 2, 4, 7, 13, 22, 36, 56, 91, 135, 211, 307, 446, 625, 882, 1194, 1677, 2238, 3031, 4001, 5460, 6995, 9302, 11921, 15424, 19554, 25032, 31005, 39170, 48251, 59917, 73093, 90831, 109271, 134049, 160922, 196109, 234179, 284157, 335933, 408390, 482597, 575109
Offset: 0

Views

Author

Gus Wiseman, Jun 01 2019

Keywords

Examples

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

Crossrefs

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],UnsameQ@@Plus@@@Subsets[#]&]],{n,0,10}]

Extensions

a(18)-a(42) from Alois P. Heinz, Jun 03 2019

A325877 Number of strict integer partitions of n such that every orderless pair of distinct parts has a different sum.

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 4, 5, 6, 8, 9, 12, 14, 18, 19, 26, 28, 36, 37, 50, 52, 67, 68, 89, 94, 115, 121, 151, 160, 195, 200, 247, 265, 312, 329, 386, 418, 487, 519, 600, 640, 742, 792, 901, 978, 1088, 1185, 1331, 1453, 1605, 1729, 1925, 2101, 2311, 2524, 2741, 3000
Offset: 0

Views

Author

Gus Wiseman, Jun 02 2019

Keywords

Comments

The non-strict case is A325857.

Examples

			The a(1) = 1 through a(10) = 9 partitions (A = 10):
  (1)  (2)  (3)   (4)   (5)   (6)    (7)    (8)    (9)    (A)
            (21)  (31)  (32)  (42)   (43)   (53)   (54)   (64)
                        (41)  (51)   (52)   (62)   (63)   (73)
                              (321)  (61)   (71)   (72)   (82)
                                     (421)  (431)  (81)   (91)
                                            (521)  (432)  (532)
                                                   (531)  (541)
                                                   (621)  (631)
                                                          (721)
		

Crossrefs

The subset case is A196723.
The maximal case is A325878.
The integer partition case is A325857.
The strict integer partition case is A325877.
Heinz numbers of the counterexamples are given by A325991.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n],UnsameQ@@#&&UnsameQ@@Plus@@@Subsets[Union[#],{2}]&]],{n,0,30}]

A325878 Number of maximal subsets of {1..n} such that every orderless pair of distinct elements has a different sum.

Original entry on oeis.org

1, 1, 1, 1, 4, 5, 8, 22, 40, 56, 78, 124, 222, 390, 616, 892, 1220, 1620, 2182, 3042, 4392, 6364, 9054, 12608, 16980, 22244, 28482, 36208, 45864, 58692, 75804, 98440, 128694, 168250, 218558, 281210, 357594, 449402, 560034, 693332, 853546, 1050118, 1293458, 1596144, 1975394
Offset: 0

Views

Author

Gus Wiseman, Jun 02 2019

Keywords

Examples

			The a(1) = 1 through a(6) = 8 subsets:
  {1}  {1,2}  {1,2,3}  {1,2,3}  {1,2,4}    {1,2,3,5}
                       {1,2,4}  {2,3,4}    {1,2,3,6}
                       {1,3,4}  {2,4,5}    {1,2,4,6}
                       {2,3,4}  {1,2,3,5}  {1,3,4,5}
                                {1,3,4,5}  {1,3,5,6}
                                           {1,4,5,6}
                                           {2,3,4,6}
                                           {2,4,5,6}
		

Crossrefs

The subset case is A196723.
The integer partition case is A325857.
The strict integer partition case is A325877.
Heinz numbers of the counterexamples are given by A325991.

Programs

  • Mathematica
    fasmax[y_]:=Complement[y,Union@@(Most[Subsets[#]]&/@y)];
    Table[Length[fasmax[Select[Subsets[Range[n]],UnsameQ@@Plus@@@Subsets[Union[#],{2}]&]]],{n,0,10}]
  • PARI
    a(n)={
       my(ismaxl(b,w)=for(k=1, n, if(!bittest(b,k) && !bitand(w,b< n, ismaxl(b,w),
             my(s=self()(k+1, r, b, w));
             if(!bitand(w,b<Andrew Howroyd, Mar 23 2025

Extensions

a(21) onwards from Andrew Howroyd, Mar 23 2025

A325859 Number of maximal subsets of {1..n} such that every orderless pair of distinct elements has a different product.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 4, 4, 11, 11, 28, 28, 60, 60, 140, 241, 299, 299, 572, 572, 971
Offset: 0

Views

Author

Gus Wiseman, May 31 2019

Keywords

Examples

			The a(1) = 1 through a(9) = 11 subsets:
  {1}  {12}  {123}  {1234}  {12345}  {2356}   {23567}   {123457}  {235678}
                                     {12345}  {123457}  {123578}  {1234579}
                                     {12456}  {124567}  {124567}  {1235789}
                                     {13456}  {134567}  {125678}  {1245679}
                                                        {134567}  {1256789}
                                                        {134578}  {1345679}
                                                        {135678}  {1345789}
                                                        {145678}  {1356789}
                                                        {234578}  {1456789}
                                                        {235678}  {2345789}
                                                        {245678}  {2456789}
		

Crossrefs

The subset case is A196724.
The maximal case is A325859.
The integer partition case is A325856.
The strict integer partition case is A325855.
Heinz numbers of the counterexamples are given by A325993.

Programs

  • Mathematica
    fasmax[y_]:=Complement[y,Union@@(Most[Subsets[#]]&/@y)];
    Table[Length[fasmax[Select[Subsets[Range[n]],UnsameQ@@Times@@@Subsets[#,{2}]&]]],{n,0,15}]

A325876 Number of strict Golomb partitions of n.

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 3, 5, 6, 6, 9, 11, 10, 15, 17, 18, 24, 29, 27, 38, 43, 47, 53, 67, 67, 84, 87, 102, 113, 137, 131, 167, 179, 204, 213, 261, 263, 315, 327, 377, 413, 476, 472, 564, 602, 677, 707, 820, 845, 969, 1027, 1131, 1213, 1364, 1413, 1596, 1700, 1858
Offset: 0

Views

Author

Gus Wiseman, Jun 02 2019

Keywords

Comments

We define a Golomb partition of n to be an integer partition of n such that every ordered pair of distinct parts has a different difference.
Also the number of strict integer partitions of n such that every orderless pair of (not necessarily distinct) parts has a different sum.
The non-strict case is A325858.

Examples

			The a(2) = 1 through a(11) = 11 partitions (A = 10, B = 11):
  (2)  (3)   (4)   (5)   (6)   (7)    (8)    (9)    (A)    (B)
       (21)  (31)  (32)  (42)  (43)   (53)   (54)   (64)   (65)
                   (41)  (51)  (52)   (62)   (63)   (73)   (74)
                               (61)   (71)   (72)   (82)   (83)
                               (421)  (431)  (81)   (91)   (92)
                                      (521)  (621)  (532)  (A1)
                                                    (541)  (542)
                                                    (631)  (632)
                                                    (721)  (641)
                                                           (731)
                                                           (821)
		

Crossrefs

The subset case is A143823.
The maximal case is A325879.
The integer partition case is A325858.
The strict integer partition case is A325876.
Heinz numbers of the counterexamples are given by A325992.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n],UnsameQ@@#&&UnsameQ@@Subtract@@@Subsets[Union[#],{2}]&]],{n,0,30}]
  • Python
    from collections import Counter
    from itertools import combinations
    from sympy.utilities.iterables import partitions
    def A325876(n): return sum(1 for p in partitions(n) if max(list(Counter(abs(d[0]-d[1]) for d in combinations(list(Counter(p).elements()),2)).values()),default=1)==1)-(n&1^1) if n else 1 # Chai Wah Wu, Sep 17 2023

A325992 Heinz numbers of integer partitions such that not every ordered pair of distinct parts has a different difference.

Original entry on oeis.org

30, 60, 90, 105, 110, 120, 150, 180, 210, 220, 238, 240, 270, 273, 300, 315, 330, 360, 385, 390, 420, 440, 450, 462, 476, 480, 506, 510, 525, 540, 546, 550, 570, 600, 627, 630, 660, 690, 714, 720, 735, 750, 770, 780, 806, 810, 819, 840, 858, 870, 880, 900, 910
Offset: 1

Views

Author

Gus Wiseman, Jun 02 2019

Keywords

Comments

The Heinz number of an integer partition (y_1,...,y_k) is prime(y_1)*...*prime(y_k).

Examples

			The sequence of terms together with their prime indices begins:
   30: {1,2,3}
   60: {1,1,2,3}
   90: {1,2,2,3}
  105: {2,3,4}
  110: {1,3,5}
  120: {1,1,1,2,3}
  150: {1,2,3,3}
  180: {1,1,2,2,3}
  210: {1,2,3,4}
  220: {1,1,3,5}
  238: {1,4,7}
  240: {1,1,1,1,2,3}
  270: {1,2,2,2,3}
  273: {2,4,6}
  300: {1,1,2,3,3}
  315: {2,2,3,4}
  330: {1,2,3,5}
  360: {1,1,1,2,2,3}
  385: {3,4,5}
  390: {1,2,3,6}
		

Crossrefs

The subset case is A143823.
The maximal case is A325879.
The integer partition case is A325858.
The strict integer partition case is A325876.
Heinz numbers of the counterexamples are given by A325992.

Programs

  • Mathematica
    Select[Range[1000],!UnsameQ@@Subtract@@@Subsets[PrimePi/@First/@FactorInteger[#],{2}]&]

A325865 Number of maximal subsets of {1..n} of which every subset has a different sum.

Original entry on oeis.org

1, 1, 1, 3, 3, 6, 14, 23, 27, 40, 64, 104, 180, 275, 399, 554, 679, 872, 1117, 1431, 1920, 2520, 3530, 4751, 6644, 8855, 12021, 15461, 19939, 25109, 31656, 38750, 46204, 55650, 65942, 78045, 91304, 106592, 124761, 145701, 172343, 201217, 238739, 280601, 339746, 400394
Offset: 0

Views

Author

Gus Wiseman, Jun 01 2019

Keywords

Examples

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

Crossrefs

Programs

  • Mathematica
    fasmax[y_]:=Complement[y,Union@@(Most[Subsets[#]]&)/@y];
    Table[Length[fasmax[Select[Subsets[Range[n]],UnsameQ@@Plus@@@Subsets[#]&]]],{n,0,10}]
  • PARI
    a(n)={
      my(ismaxl(w)=for(k=1, n, if(!bitand(w,w< n, ismaxl(w),
             my(s=self()(k+1, b,w));
             if(!bitand(w,w<Andrew Howroyd, Mar 23 2025

Extensions

a(18) onwards from Andrew Howroyd, Mar 23 2025

A325880 Number of maximal subsets of {1..n} containing n such that every ordered pair of distinct elements has a different difference.

Original entry on oeis.org

1, 1, 2, 2, 4, 8, 8, 10, 18, 34, 50, 70, 78, 89, 120, 181, 277, 401, 561, 728, 867, 1031, 1219, 1537, 2013, 2684, 3581, 4973, 6435, 8124, 9974, 12054, 14057, 16890, 19783, 24102, 29539, 37247, 46301, 59825, 74556, 94064, 115057, 141068, 167521, 200790, 232798, 273734
Offset: 1

Views

Author

Gus Wiseman, Jun 02 2019

Keywords

Comments

Also the number of maximal subsets of {1..n} containing n such that every orderless pair of (not necessarily distinct) elements has a different sum.

Examples

			The a(2) = 1 through a(9) = 18 subsets:
  {1,2}  {1,3}  {1,2,4}  {1,2,5}  {1,2,6}  {2,3,7}    {3,5,8}    {4,6,9}
         {2,3}  {1,3,4}  {1,4,5}  {1,3,6}  {2,4,7}    {4,5,8}    {5,6,9}
                         {2,3,5}  {1,4,6}  {2,6,7}    {1,2,4,8}  {1,2,4,9}
                         {2,4,5}  {1,5,6}  {3,4,7}    {1,2,6,8}  {1,2,6,9}
                                  {2,3,6}  {4,5,7}    {1,3,4,8}  {1,2,7,9}
                                  {2,5,6}  {4,6,7}    {1,3,7,8}  {1,3,4,9}
                                  {3,4,6}  {1,2,5,7}  {1,5,6,8}  {1,3,8,9}
                                  {3,5,6}  {1,3,6,7}  {1,5,7,8}  {1,4,8,9}
                                                      {2,3,6,8}  {1,6,7,9}
                                                      {2,4,7,8}  {1,6,8,9}
                                                                 {2,3,5,9}
                                                                 {2,3,7,9}
                                                                 {2,4,5,9}
                                                                 {2,4,8,9}
                                                                 {2,6,7,9}
                                                                 {2,6,8,9}
                                                                 {3,4,7,9}
                                                                 {3,5,8,9}
		

Crossrefs

Programs

  • Mathematica
    fasmax[y_]:=Complement[y,Union@@(Most[Subsets[#]]&/@y)];
    Table[Length[fasmax[Select[Subsets[Range[n]],MemberQ[#,n]&&UnsameQ@@Subtract@@@Subsets[Union[#],{2}]&]]],{n,0,10}]
  • PARI
    a(n)={
      my(ismaxl(b,w)=for(k=1, n, if(!bittest(b,k) && !bitand(w,bitor(b,1<= n, ismaxl(b,w),
             my(s=self()(k+1, b,w));
             b+=1<Andrew Howroyd, Mar 23 2025

Extensions

a(25) onwards from Andrew Howroyd, Mar 23 2025
Showing 1-10 of 15 results. Next