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 21-26 of 26 results.

A292698 Number of solutions to 3 +- 7 +- 13 +- 19 +- ... +- prime(4*n) = 0.

Original entry on oeis.org

0, 0, 0, 1, 2, 8, 27, 83, 292, 944, 3279, 11291, 38992, 138066, 490248, 1757360, 6347321, 22998089, 83780199, 306819363, 1128999790, 4174251748, 15507225620, 57767819903, 215327188611, 803901214851, 3013081897103, 11331883386143, 42737620941612
Offset: 1

Views

Author

Seiichi Manyama, Sep 21 2017

Keywords

Examples

			For n = 4 the solution is 3 - 7 - 13 + 19 - 29 + 37 + 43 - 53 = 0.
		

Crossrefs

Programs

  • Maple
    s:= proc(n) s(n):= `if`(n=0, 0, ithprime(2*n)+s(n-1)) end:
    b:= proc(n, i) option remember; `if`(n>s(i), 0, `if`(i=0, 1,
          (p-> b(n+p, i-1)+b(abs(n-p), i-1))(ithprime(2*i))))
        end:
    a:= n-> b(0, 2*n)/2:
    seq(a(n), n=1..30);  # Alois P. Heinz, Sep 21 2017
  • Mathematica
    s[n_] := s[n] = If[n == 0, 0, Prime[2n] + s[n-1]];
    b[n_, i_] := b[n, i] = If[n > s[i], 0, If[i == 0, 1,
         With[{p = Prime[2i]}, b[n+p, i-1] + b[Abs[n-p], i-1]]]];
    a[n_] := b[0, 2n]/2;
    Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Apr 30 2022, after Alois P. Heinz *)
  • PARI
    {a(n) = 1/2*polcoeff(prod(k=1, 2*n, x^prime(2*k)+1/x^prime(2*k)), 0)}

Formula

Constant term in the expansion of 1/2 * Product_{k=1..2*n} (x^prime(2*k) + 1/x^prime(2*k)).

A292699 Number of solutions to 5 +- 11 +- 17 +- 23 +- ... +- prime(4*n+1) = 0.

Original entry on oeis.org

0, 1, 1, 2, 2, 5, 28, 102, 242, 835, 3381, 10115, 39415, 138555, 465778, 1741167, 6081563, 22156403, 81090107, 301185788, 1098440558, 4071519963, 15235221189, 56764430821, 211797564907, 790029575790, 2962705350767, 11154931819979, 42097079364709
Offset: 1

Views

Author

Seiichi Manyama, Sep 21 2017

Keywords

Examples

			For n=2 the solution is 5-11-17+23 = 0.
For n=3 the solution is 5+11+17-23+31-41 = 0.
For n=4 the 2 solutions are 5-11+17+23+31+41-47-59 = 0 and 5+11-17+23+31-41+47-59 = 0.
		

Crossrefs

Programs

  • Maple
    s:= proc(n) s(n):= `if`(n=0, 0, ithprime(2*n+1)+s(n-1)) end:
    b:= proc(n, i) option remember; `if`(n>s(i), 0, `if`(i=0, 1,
          (p-> b(n+p, i-1)+b(abs(n-p), i-1))(ithprime(2*i+1))))
        end:
    a:= n-> b(0, 2*n)/2:
    seq(a(n), n=1..30);  # Alois P. Heinz, Sep 21 2017
  • Mathematica
    s[n_] := s[n] = If[n == 0, 0, Prime[2n+1] + s[n-1]];
    b[n_, i_] := b[n, i] = If[n > s[i], 0, If[i == 0, 1,
         With[{p = Prime[2i+1]}, b[n+p, i-1] + b[Abs[n-p], i-1]]]];
    a[n_] := b[0, 2n]/2;
    Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Apr 30 2022, after Alois P. Heinz *)
  • PARI
    {a(n) = 1/2*polcoeff(prod(k=1, 2*n, x^prime(2*k+1)+1/x^prime(2*k+1)), 0)}

Formula

Constant term in the expansion of 1/2 * Product_{k=1..2*n} (x^prime(2*k+1) + 1/x^prime(2*k+1)).

A215036 2 followed by "1,0" repeated.

Original entry on oeis.org

2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1
Offset: 1

Views

Author

N. J. A. Sloane, Aug 06 2012

Keywords

Comments

Take the first n primes and combine them with coefficients +1 and -1; then a(n) is the smallest number (in absolute value) that can be obtained.
For example, a(1) = 2, a(2) = 1 from 3-2 = 1; a(3) = 0 from -2-3+5 = 0; a(11) = 0 from 2-3-5-7+11-13+17+19-23-29+31 = 0.
Comment from Franklin T. Adams-Watters, Aug 05 2012: Sketch of proof that the above sum of primes results in this sequence. If S_n is the set of possible values of the signed sums for the first n primes, then S_{n+1} = S_n U (S_n + prime(n+1)) U (S_n - prime(n+1)). Beyond about n=4, this will be everything even or everything odd in an interval around zero, and then a fringe on either side; the size of the interval will be 2 * A007504(n) - k for some small k. Recursively, since prime(n) << A007504(n), this will continue to hold. Hence the sequence continues to alternate 0's and 1's. A quite modest estimate on the distribution of primes suffices to complete the proof.
For number of solutions see A022894, A113040; also A083309.

Crossrefs

Essentially the same as A135528, A059841, A000035.

Programs

A215221 Number of solutions to p(n) = Sum_{i=1..n-1} c(i)*p(i) with c(i) in {-1,0,1} and p(n) = n-th prime.

Original entry on oeis.org

0, 0, 1, 1, 1, 5, 11, 28, 69, 164, 437, 1104, 2887, 7778, 20861, 55610, 148857, 408694, 1112103, 3059571, 8519916, 23586160, 65766961, 183122954, 508287720, 1423807763, 4019399991, 11359914488, 32294035715, 91866217942, 258134484981, 732226048291
Offset: 1

Views

Author

Alois P. Heinz, Aug 06 2012

Keywords

Examples

			a(3) = 1: prime(3) = 5 = 3+2.
a(4) = 1: prime(4) = 7 = 5+2.
a(5) = 1: prime(5) = 11 = 7+5-3+2.
a(6) = 5: prime(6) = 13 = 7+5+3-2 = 11+2 = 11+5-3 = 11+7-3-2 = 11+7-5.
a(7) = 11: prime(7) = 17 = 7+5+3+2 = 11+5+3-2 = 11+7-3+2 = 13+5-3+2 = 13+7-3 = 13+7-5+2 = 13-11+7+5+3 = 13+11-5-2 = 13+11-7 = 13+11-7-5+3+2 = 13+11-7+5-3-2.
		

Crossrefs

Programs

  • Maple
    sp:= proc(n) option remember; `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, i-1)+ b(n+ithprime(i), i-1)+ b(abs(n-ithprime(i)), i-1)))
         end:
    a:= n-> b(ithprime(n), n-1):
    seq(a(n), n=1..40);
  • Mathematica
    nmax = 40; d = {1}; a1 = {};
    Do[
      p = Prime[n];
      i = Ceiling[Length[d]/2] + p;
      AppendTo[a1, If[i > Length[d], 0, d[[i]]]];
      d = PadLeft[d, Length[d] + 2 p] + PadRight[d, Length[d] + 2 p] +
        PadLeft[PadRight[d, Length[d] + p], Length[d] + 2 p];
      , {n, nmax}];
    a1 (* Ray Chandler, Mar 11 2014 *)

Formula

a(n) = A215222(A000040(n)).

A215222 Number of solutions to n = Sum_{i=1..pi(n-1)} c(i)*p(i) with c(i) in {-1,0,1}, p(n) = n-th prime and pi = A000720.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 1, 5, 5, 13, 12, 11, 11, 29, 28, 74, 73, 71, 69, 184, 182, 176, 173, 170, 164, 446, 437, 1180, 1165, 1147, 1137, 1115, 1104, 2984, 2949, 2919, 2887, 7841, 7778, 21331, 21184, 21029, 20861, 57465, 57114, 56741, 56372, 55997, 55610
Offset: 1

Views

Author

Alois P. Heinz, Aug 06 2012

Keywords

Examples

			a(5) = 1: 5 = 3+2.
a(6) = 1: 6 = 5+3-2.
a(7) = 1: 7 = 5+2.
a(8) = 2: 8 = 5+3 = 7+3-2.
a(9) = 2: 9 = 7+2 = 7+5-3.
a(10) = 3: 10 = 5+3+2 = 7+3 = 7+5-2.
a(11) = 1: 11 = 7+5-3+2.
a(12) = 5: 12 = 7+3+2 = 7+5 = 11+3-2 = 11-7+5+3 = 11+7-5-3+2.
		

Crossrefs

Programs

  • Maple
    sp:= proc(n) option remember; `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, i-1)+
            b(n+ithprime(i), i-1)+ b(abs(n-ithprime(i)), i-1)))
         end:
    a:= n-> b(n, numtheory[pi](n-1)):
    seq(a(n), n=1..60);
  • Mathematica
    sp[n_] := 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, i-1] + b[n+Prime[i], i-1] + b[Abs[n-Prime[i]], i-1]]]; a[n_] := b[n, PrimePi[n-1]]; Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Dec 03 2014, after Alois P. Heinz *)

A238894 Irregular triangle of the number of times that sums +- 3 +- 5 +- 7 +- 11 +-...+- prime(2n+1) equal an even number in the range -d to d, where d = 3 + 5 + 7 + 11 +...+ prime(2n+1).

Original entry on oeis.org

1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0
Offset: 1

Views

Author

T. D. Noe, Mar 07 2014

Keywords

Comments

Because the value at odd numbers is zero, we count only the values at even numbers. This sequence, a generalization of A083309, is more interesting plotted.
The rows of the irregular triangle begin at positions 1, 10, 37, 94, 193, 352, 589, 916, 1355, 1922, 2633, 3506, 4565, 5828, and 7307. having lengths 9, 27, 57, 99, 159, 237, 327, 439, 567, 711, 873, 1059, 1263, 1479, and 1719.

Examples

			The first row of the irregular triangle is {1, 0, 0, 1, 0, 1, 0, 0, 1} because the sums +- 3 +- 5 form the numbers -8, -2, 2, and 8. The odd numbers are suppressed.
		

Crossrefs

Cf. A083309.

Programs

  • Mathematica
    nMax = 10; d = {1, 0, 0, 1}; t = {}; Do[p = Prime[n + 1]; d = PadLeft[d, Length[d] + p] + PadRight[d, Length[d] + p]; If[0 == Mod[n, 2], AppendTo[t, d]], {n, 2, nMax}]; Flatten[t]
Previous Showing 21-26 of 26 results.