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

A196237 Number of different ways to select 10 disjoint subsets from {1..n} with equal element sum.

Original entry on oeis.org

1, 3, 15, 44, 179, 741, 2989, 13932, 79433, 456134, 3096812, 21083037, 151022325, 1119202826, 8627014654
Offset: 19

Views

Author

Alois P. Heinz, Sep 29 2011

Keywords

Examples

			a(20) = 3: {1,18}, {2,17}, {3,16}, {4,15}, {5,14}, {6,13}, {7,12}, {8,11}, {9,10}, {19} have element sum 19; {1,19}, {2,18}, {3,17}, {4,16}, {5,15}, {6,14}, {7,13}, {8,12}, {9,11}, {20} have element sum 20; {1,20}, {2,19}, {3,18}, {4,17}, {5,16}, {6,15}, {7,14}, {8,13}, {9,12}, {10,11} have element sum 21.
		

Crossrefs

Programs

  • Mathematica
    b[l_, n_, k_] := b[l, n, k] = Module[{i, j}, If[l == Array[0 &, k], 1, If[Total[l] > n*(n - 1)/2, 0, b[l, n - 1, k]] + Sum[If[l[[j]] - n < 0, 0, b[Sort[Table[l[[i]] - If[i == j, n, 0], {i, 1, k}]], n - 1, k]], {j, 1, k}]]];
    T[n_, k_] := Sum[b[Array[t &, k], n, k], {t, 2*k - 1, Floor[n*(n + 1)/(2*k) ]}]/k!;
    a[n_] := T[n, 10];
    Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 19, 30}] (* Jean-François Alcover, Jun 08 2018, after Alois P. Heinz *)

Extensions

a(31)-a(33) from Bert Dobbelaere, Sep 02 2019

A342804 Number of solutions to 1 +-*/ 2 +-*/ 3 +-*/ ... +-*/ n = 0.

Original entry on oeis.org

0, 0, 1, 1, 1, 5, 8, 18, 39, 91, 185, 460, 1051, 2526, 6280, 15645, 35516, 93765, 225989, 611503
Offset: 1

Views

Author

Scott R. Shannon, Mar 27 2021

Keywords

Comments

Normal operator precedence is followed, so multiplication and division are performed before addition or subtraction, and each operator only acts on the following term, so 2 / 3 * 4 equals (2 / 3) * 4.
Unlike A058377, which uses only addition and subtraction, this sequence has solutions for all values of n >= 3.

Examples

			a(3) = 1 as 1 + 2 - 3 = 0 is the only solution.
a(4) = 1 as 1 - 2 - 3 + 4 = 0 is the only solution.
a(5) = 1 as 1 * 2 - 3 - 4 + 5 = 0 is the only solution. This is the first term where a solution exists while no corresponding solution exists in A058377.
a(6) = 5. The solutions, all of which use multiplication or division, are
         1 + 2 * 3 + 4 - 5 - 6 = 0,
         1 - 2 + 3 * 4 - 5 - 6 = 0,
         1 - 2 * 3 + 4 - 5 + 6 = 0,
         1 * 2 + 3 - 4 + 5 - 6 = 0,
         1 - 2 / 3 / 4 - 5 / 6 = 0.
  The last solution is the first that uses division.
a(7) = 8. Six solutions use just addition, division and multiplication. The other two are
         1 + 2 - 3 * 4 * 5 / 6 + 7 = 0,
         1 / 2 * 3 * 4 - 5 + 6 - 7 = 0.
a(15) = 6280. An example solution is
         1 / 2 / 3 / 4 * 5 * 6 - 7 - 8 + 9 / 10 + 11 / 12 * 13 + 14 / 15 = 0
  which includes four fractions that sum to 15, which is balanced by - 7 - 8.
a(20) = 611503. An example solution is
         1 / 2 / 3 / 4 / 5 + 6 / 7 / 8 / 9 / 10 * 11 / 12 - 13 / 14 / 15 / 16
              + 17 / 18 - 19 / 20 = 0
  which sums five fractions that include fourteen divisions.
		

Crossrefs

Cf. A342602 (using +-*), A342995 (using +-/), A058377 (using +-), A063865, A000217, A025591, A161943.

Programs

  • Mathematica
    Table[Length@Select[Tuples[{"+","-","*","/"},k-1],ToExpression[""<>Riffle[ToString/@Range@k,#]]==0&],{k,9}] (* Giorgos Kalogeropoulos, Apr 02 2021 *)
  • Python
    from itertools import product
    from fractions import Fraction
    def a(n):
      nn = ["Fraction("+str(i)+", 1)" for i in range(1, n+1)]
      return sum(eval("".join([*sum(zip(nn, ops+("",)), ())])) == 0 for ops in product("+-*/", repeat=n-1))
    print([a(n) for n in range(1, 10)]) # Michael S. Branicky, Apr 02 2021

A342602 Number of solutions to 1 +-* 2 +-* 3 +-* ... +-* n = 0.

Original entry on oeis.org

0, 0, 1, 1, 1, 4, 6, 14, 29, 63, 129, 300, 756, 1677, 4134, 9525, 22841, 57175, 141819, 354992, 882420, 2218078, 5588989, 14173217, 35918542
Offset: 1

Views

Author

Scott R. Shannon, Mar 27 2021

Keywords

Comments

Normal operator precedence is followed, so multiplication is performed before addition or subtraction. Unlike A058377, which uses only addition and subtraction, this sequence has solutions for all values of n >= 3.
The author thanks Ursula Ponting for useful discussions.

Examples

			a(3) = 1 as 1 + 2 - 3 = 0 is the only solution.
a(4) = 1 as 1 - 2 - 3 + 4 = 0 is the only solution.
a(5) = 1 as 1 * 2 - 3 - 4 + 5 = 0 is the only solution. This is the first term where a solution exists while no corresponding solution exists in A058377.
a(6) = 4. The solutions, all of which use multiplication, are
         1 + 2 * 3 + 4 - 5 - 6 = 0,
         1 - 2 + 3 * 4 - 5 - 6 = 0,
         1 - 2 * 3 + 4 - 5 + 6 = 0,
         1 * 2 + 3 - 4 + 5 - 6 = 0.
a(10) = 63. An example solution is
         1 - 2 * 3 * 4 - 5 - 6 - 7 * 8 + 9 * 10 = 0.
a(20) = 354992. An example solution is
         1 * 2 * 3 * 4 * 5 * 6 * 7 + 8 * 9 + 10 * 11 - 12 * 13 + 14 * 15
             - 16 * 17 * 18 - 19 * 20 = 0
  which includes thirteen multiplications.
		

Crossrefs

Cf. A342804 (using +-*/), A342995 (using +-/), A058377 (using +-), A063865, A000217, A025591, A161943.

Programs

  • Mathematica
    Table[Length@Select[Tuples[{"+","-","*"},k-1],ToExpression[""<>Riffle[ToString/@Range@k,#]]==0&],{k,11}] (* Giorgos Kalogeropoulos, Apr 02 2021 *)
  • Python
    from itertools import product
    def a(n):
      nn = [str(i) for i in range(1, n+1)]
      return sum(eval("".join([*sum(zip(nn, ops+("",)), ())])) == 0 for ops in product("+-*", repeat=n-1))
    print([a(n) for n in range(1, 14)]) # Michael S. Branicky, Apr 02 2021

A342995 Number of solutions to 1 +-/ 2 +-/ 3 +-/ ... +-/ n = 0.

Original entry on oeis.org

0, 0, 1, 1, 0, 1, 4, 8, 0, 3, 37, 80, 6, 17, 461, 868, 190, 364, 5570, 11342, 3993, 7307, 78644
Offset: 1

Views

Author

Scott R. Shannon, Apr 01 2021

Keywords

Comments

Normal operator precedence is followed, so division is performed before addition or subtraction. Unlike A058377, which uses only addition and subtraction, this sequence has solutions for all values of n >= 10.

Examples

			a(3) = 1 as 1 + 2 - 3 = 0 is the only solution.
a(4) = 1 as 1 - 2 - 3 + 4 = 0 is the only solution.
a(5) = 0, as in A058377.
a(6) = 1 as 1 - 2 / 3 / 4 - 5 / 6 = 0 is the only solution. This is the first term where a solution exists while no corresponding solution exists in A058377.
a(8) = 8. Seven of the solutions involve just addition and subtraction, matching those in A058377, but one additional solution exists using division:
        1 / 2 / 3 / 4 + 5 / 6 - 7 / 8 = 0.
a(10) = 3. All three solutions require division:
        1 + 2 / 3 / 4 + 5 / 6 + 7 - 8 + 9 - 10 = 0,
        1 - 2 / 3 / 4 - 5 / 6 + 7 - 8 - 9 + 10 = 0,
        1 - 2 / 3 / 4 - 5 / 6 - 7 + 8 + 9 - 10 = 0.
a(15) = 461. Of these, 361 use only addition and subtraction, the other 100 also require division. One example of the latter is
        1 / 2 / 3 / 4 - 5 - 6 - 7 / 8 + 9 / 10 + 11 + 12 - 13 + 14 / 15 = 0.
a(20) = 11342. An example solution is
        1 / 2 / 3 - 4 / 5 / 6 + 7 / 8 / 9 + 10 + 11 / 12 - 13 + 14 / 15 / 16
             + 17 / 18 + 19 / 20 = 0
  which sums seven fractions that include eleven divisions.
		

Crossrefs

Cf. A342804 (using +-*/), A342602 (using +-*), A058377 (using +-), A063865, A000217, A025591, A161943.

Programs

  • Mathematica
    Table[Length@Select[Tuples[{"+","-","/"},k-1],ToExpression[""<>Riffle[ToString/@Range@k,#]]==0&],{k,11}] (* Giorgos Kalogeropoulos, Apr 02 2021 *)
  • Python
    from itertools import product
    from fractions import Fraction
    def a(n):
      nn = ["Fraction("+str(i)+", 1)" for i in range(1, n+1)]
      return sum(eval("".join([*sum(zip(nn, ops+("",)), ())])) == 0 for ops in product("+-/", repeat=n-1))
    print([a(n) for n in range(1, 11)]) # Michael S. Branicky, Apr 02 2021

A196534 Number of different ways to select disjoint nonempty subsets from {1..n} with equal element sum.

Original entry on oeis.org

1, 3, 8, 18, 39, 83, 179, 388, 857, 1914, 4494, 10844, 26923, 70645, 192297, 538646, 1579602, 4793718, 15010425, 48941642, 164010913, 566065123, 2025354291, 7450901462, 27986863322, 107940691328
Offset: 1

Views

Author

Alois P. Heinz, Oct 03 2011

Keywords

Comments

A000225(n) <= a(n) <= A058692(n+1).

Examples

			a(3) = 8: {{1}}, {{2}}, {{3}}, {{1,2}}, {{1,3}}, {{2,3}}, {{1,2,3}}, {{1,2},{3}}. Element sums are 1, 2, 3, 3, 4, 5, 6, and 3, respectively.
		

Crossrefs

Programs

  • Maple
    b:= proc(l, n, k) option remember; local i, j; `if`(l=[0$k], 1, `if`(add(j, j=l)>n*(n-1)/2, 0, b(l, n-1, k))+ add(`if`(l[j]-n<0, 0, b(sort([seq(l[i] -`if`(i=j, n, 0), i=1..k)]), n-1, k)), j=1..k)) end: a:= n-> add(add(b([t$k], n, k), t=2*k-1..floor(n*(n+1)/(2*k)))/k!, k=1..n): seq(a(n), n=1..15);
  • Mathematica
    b[l_, n_, k_] := b[l, n, k] = If[l == Array[0&, k], 1, If[Total[l] > n*(n-1)/2, 0, b[l, n-1, k]] + Sum[If[l[[j]]-n < 0, 0, b[Sort[Table[ l[[i]] - If[i == j, n, 0], {i, 1, k}]], n-1, k]], {j, 1, k}]];
    a[n_] := Sum[Sum[b[Array[t&, k], n, k], {t, 2*k-1, Floor[n*(n+1)/(2*k)]} ]/k!, {k, 1, Ceiling[n/2]}];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 25}] (* Jean-François Alcover, Jun 01 2022, after Alois P. Heinz *)

Extensions

a(26) from Alois P. Heinz, Oct 20 2014
Previous Showing 11-15 of 15 results.