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

A022894 Number of solutions to c(1)*prime(1) +...+ c(2n+1)*prime(2n+1) = 0, where c(i) = +-1 for i > 1, c(1) = 1.

Original entry on oeis.org

0, 1, 1, 2, 5, 13, 39, 122, 392, 1286, 4341, 14860, 51085, 178402, 634511, 2260918, 8067237, 29031202, 105250449, 383579285, 1404666447, 5171065198, 19141008044, 71124987313, 263548339462, 983424096451, 3684422350470, 13818161525284, 51938115653565
Offset: 0

Views

Author

Keywords

Comments

c(1)*prime(1) + ... + c(2n)*prime(2n) = 0 has no solution, because the l.h.s. has an odd number of odd terms and the r.h.s. is even.

Examples

			a(1) = 1 because 2 + 3 - 5 = 0,
a(2) = 1 because 2 - 3 + 5 + 7 - 11 = 0,
a(3) = 2 because
  2 + 3 - 5 - 7 + 11 + 13 - 17 =
  2 + 3 - 5 + 7 - 11 - 13 + 17 = 0.
a(4) = 5 because
  2 - 3 - 5 + 7 + 11 + 13 + 17 - 19 - 23 =
  2 - 3 + 5 - 7 + 11 + 13 - 17 + 19 - 23 =
  2 - 3 + 5 + 7 - 11 - 13 + 17 + 19 - 23 =
  2 - 3 + 5 + 7 - 11 + 13 - 17 - 19 + 23 =
  2 + 3 + 5 - 7 - 11 - 13 + 17 - 19 + 23 = 0
and there are no others up through the ninth prime.
		

Crossrefs

Cf. A113040, A215036, A083309 (sums of odd primes).
Cf. A022895, A022896 (r.h.s. = 1 & 2, using all primes), A083309 and A022897 - A022899 (using primes >= 3), A022900 - A022902 (using primes >=5), A022903, A022904, A022920 (using primes >= 7); A261061 - A261063 & A261045 (r.h.s. = -1); A261057, A261059, A261060 & A261044 (r.h.s. = -2).
Bisection (odd part) of A306443.

Programs

  • Maple
    sp:= proc(n) sp(n):= `if`(n=1, 0, ithprime(n)+sp(n-1)) end:
    b := proc(n,i) option remember; `if`(n>sp(i), 0, `if`(i=1, 1,
            b(n+ithprime(i), i-1)+ b(abs(n-ithprime(i)), i-1)))
         end:
    a:= n-> b(2, 2*n+1):
    seq(a(n), n=0..40);  # Alois P. Heinz, Aug 05 2012
  • Mathematica
    Do[a = Table[ Prime[i], {i, 1, n} ]; c = 0; k = 2^(n - 1); While[k < 2^n, If[ Apply[ Plus, a*(-1)^(IntegerDigits[k, 2] + 1)] == 0, c++ ]; k++ ]; Print[c], {n, 1, 32, 2} ]
  • PARI
    A022894={a(n, s=0-prime(1), p=1)=if(n<=s, if(s==p, n==s, a(abs(n-p), s-p, precprime(p-1))+a(n+p, s-p, precprime(p-1))), if(s<=0, a(abs(s), max(sum(i=p+1, p+(p>1)+2*n, prime(i)),1), prime(p+(p>1)+2*n))))} \\ M. F. Hasler, Aug 09 2015

Formula

Conjecture: limit_{n->oo} a(n)^(1/n) = 4. - Vaclav Kotesovec, Jun 05 2019
a(n) is the constant term in expansion of (1/2) * Product_{k=1..2*n+1} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 25 2024

Extensions

Edited by Robert G. Wilson v, Jan 29 2002
More terms from T. D. Noe, Jan 16 2007
Edited by M. F. Hasler, Aug 09 2015

A113040 Number of solutions to +-p(1)+-p(2)+-...+-p(2n)=1 where p(i) is the i-th prime.

Original entry on oeis.org

1, 1, 3, 6, 16, 45, 138, 439, 1417, 4698, 16021, 55146, 190274, 671224, 2404289, 8535117, 30635869, 110496946, 401422210, 1467402238, 5393176633, 19883249002, 73856531314, 273602448261, 1017563027699, 3803902663467, 14266523388813, 53564969402478
Offset: 1

Views

Author

Floor van Lamoen, Oct 12 2005

Keywords

Comments

+-p(1)+-p(2)+-...+-p(2n+1)=1 has no solutions because the l.h.s. is even.

Examples

			2 + 3 + 5 - 7 + 11 - 13 = - 2 + 3 + 5 - 7 - 11 + 13 = - 2 + 3 - 5 + 7 + 11 - 13 = 1 so a(3) = 3.
		

Crossrefs

Bisection (even part) of A306443.

Programs

  • Maple
    A113040:=proc(n) local i,j,p,t; t:= NULL; for j from 2 to 2*n by 2 do p:=1; for i to j do p:=p*(x^(-ithprime(i))+x^(ithprime(i))); od; t:=t,coeff(p,x,1); od; t; end;
    # second Maple program:
    sp:= proc(n) sp(n):= `if`(n=0, 0, ithprime(n)+sp(n-1)) end:
    b := proc(n,i) option remember; `if`(n>sp(i), 0, `if`(i=0, 1,
            b(n+ithprime(i), i-1)+ b(abs(n-ithprime(i)), i-1)))
         end:
    a:= n-> b(1, 2*n):
    seq(a(n), n=1..40);  # Alois P. Heinz, Aug 05 2012
  • Mathematica
    sp[n_] := If[n == 0, 0, Prime[n]+sp[n-1]]; b[n_, i_] := b[n, i] =If[n > sp[i], 0, If[i == 0, 1, b[n+Prime[i], i-1] + b[Abs[n-Prime[i]], i-1]]]; a[n_] := b[1, 2*n]; Table[a[n], {n, 1, 40}] (* Jean-François Alcover, Nov 11 2015, after Alois P. Heinz *)

Formula

a(n) = A022895(2n) + A261061(n). - M. F. Hasler, Aug 09 2015
Conjecture: limit_{n->infinity} a(n)^(1/n) = 4. - Vaclav Kotesovec, Jun 05 2019
a(n) = [x^1] Product_{k=1..2*n} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 25 2024

A069918 Number of ways of partitioning the set {1...n} into two subsets whose sums are as nearly equal as possible.

Original entry on oeis.org

1, 1, 1, 1, 3, 5, 4, 7, 23, 40, 35, 62, 221, 397, 361, 657, 2410, 4441, 4110, 7636, 28460, 53222, 49910, 93846, 353743, 668273, 632602, 1199892, 4559828, 8679280, 8273610, 15796439, 60400688, 115633260, 110826888, 212681976, 817175698, 1571588177, 1512776590
Offset: 1

Views

Author

Robert G. Wilson v, Apr 24 2002

Keywords

Comments

If n mod 4 = 0 or 3, a(n) is the number of solutions to +- 1 +- 2 +- 3 +- ... +- n = 0 or 1; if n mod 4 = 1 or 2, a(n) is half this number.

Examples

			If the triangular number T_n (see A000217) is even then the two totals must be equal, otherwise the two totals differ by one.
a(6) = 5: T6 = 21 and is odd. There are five sets such that the sum of one side is equal to the other side +/- 1. They are 5+6 = 1+2+3+4, 4+6 = 1+2+3+5, 1+4+6 = 2+3+5, 1+3+6 = 2+4+5 and 2+3+6 = 1+4+5.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i) option remember; local m; m:= i*(i+1)/2;
          `if`(n>m, 0, `if`(n=m, 1, b(abs(n-i), i-1) +b(n+i, i-1)))
        end:
    a:= n-> `if`(irem(n-1, 4)<2, b(n-1, n-1) +b(n+1, n-1), b(n, n-1)):
    seq(a(n), n=1..60);  # Alois P. Heinz, Nov 02 2011
  • Mathematica
    Needs["DiscreteMath`Combinatorica`"]; f[n_] := f[n] = Block[{s = Sort[Plus @@@ Subsets[n]], k = n(n + 1)/2}, If[ EvenQ[k], Count[s, k/2]/2, (Count[s, Floor[k/2]] + Count[s, Ceiling[k/2]]) /2]]; Table[ f[n], {n, 1, 22}]
    f[n_, s_] := f[n, s] = Which[n == 0, If[s == 0, 1, 0], Abs[s] > (n*(n + 1))/2, 0, True, f[n - 1, s - n] + f[n - 1, s + n]]; Table[ Which[ Mod[n, 4] == 0 || Mod[n, 4] == 3, f[n, 0]/2, Mod[n, 4] == 1 || Mod[n, 4] == 2, f[n, 1]], {n, 1, 40}]

Formula

If n mod 4 = 0 or 3 then the two subsets have the same sum and a(n) = A025591(n); if n mod 4 = 1 or 2 then the two subsets have sums which differ by 1 and a(n) = A025591(n)/2. - Henry Bottomley, May 08 2002

Extensions

More terms from Henry Bottomley, May 08 2002
Comment corrected by Steven Finch, Feb 01 2009

A307877 Number of ways of partitioning the set of the first n positive squares into two subsets whose sums differ at most by 1.

Original entry on oeis.org

1, 1, 0, 0, 0, 0, 2, 1, 1, 5, 2, 1, 5, 13, 43, 43, 57, 193, 274, 239, 430, 1552, 3245, 2904, 5419, 18628, 31048, 27813, 50213, 188536, 372710, 348082, 649300, 2376996, 4197425, 3913496, 7287183, 27465147, 53072709, 50030553, 93696497, 351329160, 650125358
Offset: 0

Views

Author

Alois P. Heinz, Jun 04 2019

Keywords

Examples

			a(6) = 2: 1,9,36/4,16,25; 1,4,16,25/9,36.
a(7) = 1: 1,4,16,49/9,25,36.
		

Crossrefs

Programs

  • Maple
    s:= proc(n) s(n):= `if`(n=0, 1, n^2+s(n-1)) end:
    b:= proc(n, i) option remember; `if`(i=0, `if`(n<=1, 1, 0),
          `if`(n>s(i), 0, (p-> b(n+p, i-1)+b(abs(n-p), i-1))(i^2)))
        end:
    a:= n-> ceil(b(0, n)/2):
    seq(a(n), n=0..45);
  • Mathematica
    s[n_] := s[n] = If[n == 0, 1, n^2 + s[n - 1]];
    b[n_, i_] := b[n, i] = If[i == 0, If[n <= 1, 1, 0], If[n > s[i], 0, Function[p, b[n + p, i - 1] + b[Abs[n - p], i - 1]][i^2]]];
    a[n_] := Ceiling[b[0, n]/2];
    a /@ Range[0, 45] (* Jean-François Alcover, Dec 07 2020, after Alois P. Heinz *)

Formula

a(n) = A083527(n) if n == 0 or 3 (mod 4).

A331479 Table read by rows: row n lists the numbers m such that the first n primes can be partitioned into m subsets all of which have the same sum.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 3, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 1, 3, 1, 2, 4, 5, 1, 3, 1, 2, 4, 1, 3, 1, 2, 4, 1, 7, 1, 2, 1, 3, 1, 2, 4, 5, 1, 3, 1, 2, 4, 1, 3, 1, 2, 4, 5, 8, 1, 3, 9, 1, 2, 4, 5, 8, 1, 3, 1, 2, 4, 7, 1, 3, 1, 2, 4, 1, 3, 1, 2, 4, 8
Offset: 1

Views

Author

Jon E. Schoenfield, Jan 17 2020

Keywords

Comments

Consider the following one-dimensional bin packing problem: given n items whose sizes are the first n primes, list the numbers m such that all the items can be packed into m bins of identical capacity, with each bin packed completely full. The resulting list is row n.
If a row contains a number m, it necessarily contains all divisors of m.

Examples

			In bin-packing terms, for n=19, the sum of the 19 item sizes, i.e., the sum of the first n primes, is 2 + 3 + ... + 67 = 568, whose divisors begin 1, 2, 4, 8, ...; the bin capacity must be at least 67 (the size of the largest item), and 568/67 < 9, so the number of bins m cannot exceed 8. However, the 19 items cannot be packed into 8 bins: the bin capacity would be 568/8 = 71 (which, as an odd sum, would require that each bin containing only odd-sized items -- i.e., every bin other than the one containing the item of size 2 -- contain an odd number of items, hence at least 3 items, but there are only 19 items in total). So the remaining values of m are 1 (i.e., packing all 19 items in a single bin), 2 (e.g., 568/2 = 284 = 67 + 61 + 59 + 53 + 41 + 3 = 47 + 43 + 37 + 31 + 29 + 23 + 19 + 17 + 13 + 11 + 7 + 5 + 2), and 4 (e.g., 568/4 = 142 = 67 + 61 + 11 + 3 = 59 + 53 + 23 + 7 = 47 + 43 + 37 + 13 + 2 = 41 + 31 + 29 + 19 + 17 + 5), so row 19 consists of the numbers 1, 2, and 4.
.                                       Numbers m such that
             Sum of  Divisors m of sum  1st n primes can be
      n-th   1st n       such that      partitioned into m
   n  prime  primes  m <= sum/prime(n)  subsets w/same sum
  --  -----  ------  -----------------  -------------------
   1     2       2   1                  1;
   2     3       5   1                  1;
   3     5      10   1, 2               1, 2;
   4     7      17   1                  1;
   5    11      28   1, 2               1, 2;
   6    13      41   1                  1;
   7    17      58   1, 2               1, 2;
   8    19      77   1                  1;
   9    23     100   1, 2, 4            1, 2;
  10    29     129   1, 3               1, 3;
  11    31     160   1, 2, 4, 5         1, 2, 4;
  12    37     197   1                  1;
  13    41     238   1, 2               1, 2;
  14    43     281   1                  1;
  15    47     328   1, 2, 4            1, 2, 4;
  16    53     381   1, 3               1, 3;
  17    59     440   1, 2, 4, 5         1, 2, 4, 5;
  18    61     501   1, 3               1, 3;
  19    67     568   1, 2, 4, 8         1, 2, 4;
  20    71     639   1, 3, 9            1, 3;
  21    73     712   1, 2, 4, 8         1, 2, 4;
  22    79     791   1, 7               1, 7;
  23    83     874   1, 2               1, 2;
  24    89     963   1, 3, 9            1, 3;
  25    97    1060   1, 2, 4, 5, 10     1, 2, 4, 5;
  26   101    1161   1, 3, 9            1, 3;
  27   103    1264   1, 2, 4, 8         1, 2, 4;
  28   107    1371   1, 3               1, 3;
  29   109    1480   1, 2, 4, 5, 8, 10  1, 2, 4, 5, 8;
  30   113    1593   1, 3, 9            1, 3, 9;
  31   127    1720   1, 2, 4, 5, 8, 10  1, 2, 4, 5, 8;
  32   131    1851   1, 3               1, 3;
  33   137    1988   1, 2, 4, 7, 14     1, 2, 4, 7;
  34   139    2127   1, 3               1, 3;
  35   149    2276   1, 2, 4            1, 2, 4;
  36   151    2427   1, 3               1, 3;
  37   157    2584   1, 2, 4, 8         1, 2, 4, 8;
		

Crossrefs

Showing 1-5 of 5 results.