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-8 of 8 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

A083309 a(n) is the number of times that sums 3 +- 5 +- 7 +- 11 +- ... +- prime(2n+1) of the first 2n odd primes is zero. There are 2^(2n-1) choices for the sign patterns.

Original entry on oeis.org

0, 0, 1, 2, 7, 19, 63, 197, 645, 2172, 7423, 25534, 89218, 317284, 1130526, 4033648, 14515742, 52625952, 191790090, 702333340, 2585539586, 9570549372, 35562602950, 131774529663, 491713178890, 1842214901398, 6909091641548
Offset: 1

Views

Author

T. D. Noe, Apr 29 2003

Keywords

Comments

The frequency of each possible sum is computed by the Mathematica program without explicitly computing the individual sums. Let S = 3 + 5 + 7 + ... + prime(2n+1). Because the primes do not grow very fast, it is easy to show that, for n > 2, all even numbers between -S+20 and S-20 occur at least once as a sum.
a(n) is the maximal number of subsets of {prime(2), prime(3), ..., prime(n+1)} that share the same sum. Cf. A025591, A083527.
See A238894 for a more general sequence that looks at all sums formed. - T. D. Noe, Mar 07 2014

Examples

			a(3) = 1 because there is only one sign pattern of the first six odd primes that yields zero: 3 + 5 + 7 - 11 + 13 - 17.
		

Crossrefs

Cf. A022894 (use all primes in the sum), A022895 (r.h.s. = 1), A022896 (r.h.s. = 2), A022897 (interleaved 0 for odd number of terms), ..., A022903 (using primes >= 7), A022904, A022920; A261061 - A261063 and A261044 (r.h.s. = -1); A261057, A261059, A261060, A261045 (r.h.s. = -2).

Programs

  • Mathematica
    d={1, 0, 0, 1}; nMax=32; zeroLst={}; Do[p=Prime[n+1]; d=PadLeft[d, Length[d]+p]+PadRight[d, Length[d]+p]; If[0==Mod[n, 2], AppendTo[zeroLst, d[[(Length[d]+1)/2]]]], {n, 2, nMax}]; zeroLst/2
  • PARI
    A083309(n, rhs=0, firstprime=2)={rhs-=prime(firstprime); my(p=vector(2*n-2+bittest(rhs, 0), i, prime(i+firstprime))); sum(i=1, 2^#p-1, sum(j=1, #p, (-1)^bittest(i, j-1)*p[j])==rhs)} \\ For illustrative purpose, too slow for n >> 10. - M. F. Hasler, Aug 08 2015

Formula

a(n) = A022897(2n). - M. F. Hasler, Aug 08 2015

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

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 0, 7, 0, 12, 0, 61, 0, 131, 0, 472, 0, 2039, 0, 5924, 0, 21095, 0, 76058, 0, 274023, 0, 1032989, 0, 3694643, 0, 12987172, 0, 48417270, 0, 174274092, 0, 642785629, 0, 2402825962, 0, 8918414212, 0, 32868915523, 0, 123145191037, 0
Offset: 1

Views

Author

Keywords

Comments

Each second entry is 0 because the primes that are involved are all odd and the right hand side is even. - R. J. Mathar, Aug 06 2015

Crossrefs

Cf. A022894, A022895, A022896 (r.h.s. = 0, 1 & 2, using all primes), A083309 and A022897 - A022899 (using primes >= 3), A022900 - A022902 (using primes >=5), A022903, A022904 (r.h.s. = 0 & 1, using primes >= 7); A261061 - A261063 & A261045 (r.h.s. = -1); A261057, A261059, A261060 & A261044 (r.h.s. = -2).

Programs

  • Mathematica
    b[n_, s_, p_] := b[n, s, p] = If[n <= s, If[s == p, Boole[n == s], b[Abs[n - p], s - p, NextPrime[p - 1, -1]] + b[n + p, s - p, NextPrime[p - 1, -1] ]], If[s <= 0, b[Abs[s], Sum[Prime[i], {i, p + 1, p + n - 1}], Prime[p + n - 1]]]] /. Null -> 0; a[n_] := b[n, 2 - Prime[4], 4]; Array[a, 50] (* Jean-François Alcover, Feb 14 2018, after M. F. Hasler *)
  • PARI
    A022920(n)={my(p=vector(n-1,i,prime(i+4)));sum(i=1,2^(n-1),sum(j=1,#p,(1-bittest(i,j-1)<<1)*p[j],7)==2)} \\ For illustrative purpose; too slow for n >> 20. - M. F. Hasler, Aug 08 2015
    
  • PARI
    a(n, s=2-prime(4), p=4)=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), sum(i=p+1, p+n-1, prime(i)), prime(p+n-1)))) \\ M. F. Hasler, Aug 09 2015

Formula

a(2n-1) = 0 for all n >= 1.

Extensions

Corrected by R. J. Mathar, Aug 06 2015
a(22)-a(49) from Alois P. Heinz, Aug 06 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

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

Original entry on oeis.org

1, 0, 0, 0, 0, 0, 2, 0, 4, 0, 14, 0, 38, 0, 126, 0, 394, 0, 1290, 0, 4344, 0, 14846, 0, 51068, 0, 178436, 0, 634568, 0, 2261052, 0, 8067296, 0, 29031484, 0, 105251904, 0, 383580180, 0, 1404666680, 0, 5171079172, 0, 19141098744, 0, 71125205900, 0, 263549059326
Offset: 1

Views

Author

Keywords

Examples

			a(7) counts these 2 solutions: {2, -3, -5, -7, 11, -13, 17}, {2, 3, 5, 7, -11, 13, -17}.
		

Crossrefs

Cf. A022894 (r.h.s. = 0), A022895 (r.h.s. = 1), A022897, ..., A022904, A022920 (using primes >= 7), A083309; A261061 - A261063 and A261045 (r.h.s. = -1); A261057, A261059, A261060 and A261044 (r.h.s. = -2); A113040, A113041, A113042. - M. F. Hasler, Aug 08 2015

Programs

  • Mathematica
    {f, s} = {1, 2}; Table[t = Map[Prime[# + f - 1] &, Range[2, z]]; Count[Map[Apply[Plus, #] &, Map[t # &, Tuples[{-1, 1}, Length[t]]]], s - Prime[f]], {z, 22}]
    (* A022896, a(n) = number of solutions of "sum = s" using Prime(f) to Prime(f+n-1) *)
    n = 7; t = Map[Prime[# + f - 1] &, Range[n]]; Map[#[[2]] &, Select[Map[{Apply[Plus, #], #} &, Map[t # &, Map[Prepend[#, 1] &, Tuples[{-1, 1}, Length[t] - 1]]]], #[[1]] == s &]]  (* the 2 solutions of using n=7 primes; Peter J. C. Moses, Oct 01 2013 *)
  • PARI
    A022896(n, rhs=2, firstprime=1)={rhs-=prime(firstprime); my(p=vector(n-1, i, prime(i+firstprime))); !(rhs||#p)+sum(i=1, 2^#p-1, sum(j=1, #p, (-1)^bittest(i, j-1)*p[j])==rhs)} \\ For illustrative purpose, too slow for n >> 20. - M. F. Hasler, Aug 08 2015
    
  • PARI
    a(n,s=2-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,if(n>1,a(abs(s),sum(i=p+1,p+n-1,prime(i)),prime(p+n-1)),!s)))} \\ M. F. Hasler, Aug 09 2015

Formula

a(2n-1) = A113041(n) - A261057(n), a(2n) = 0 because there is an odd number of odd terms on the left hand side, but the right hand side is even. - M. F. Hasler, Aug 09 2015
a(n) = [x^0] Product_{k=2..n} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 26 2024

Extensions

Corrected and extended by Clark Kimberling, Oct 01 2013
a(23)-a(49) from Alois P. Heinz, Aug 06 2015

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

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 0, 0, 0, 6, 0, 9, 0, 61, 0, 131, 0, 486, 0, 2029, 0, 5890, 0, 21127, 0, 75979, 0, 273657, 0, 1032161, 0, 3694665, 0, 12989200, 0, 48409376, 0, 174262116, 0, 642786775, 0, 2402713235, 0, 8918299277, 0, 32868170524, 0, 123143998606, 0
Offset: 1

Views

Author

Keywords

Examples

			a(10) counts these 6 solutions: {7, -11, -13, -17, -19, -23, 29, -31, 37, 41}, {7, 11, -13, 17, 19, -23, 29, 31, -37, -41}, {7, 11, -13, 17, 19, 23, -29, -31, 37, -41}, {7, 11, 13, -17, -19, 23, 29, 31, -37, -41}, {7, 11, 13, -17, 19, 23, -29, -31, -37, 41}, {7, 11, 13, 17, -19, -23, 29, -31, 37, -41}.
		

Crossrefs

Cf. A022894, A022895, ..., A022904, A083309, A022920 (variants with r.h.s. in {0, 1 or 2}, starting with prime(1), prime(2), prime(3) or prime(4)); A261061 - A261063 and A261045 (r.h.s. = -1); A261057, A261059, A261060, A261045(r.h.s. = -2).

Programs

  • Maple
    A022903 := proc(n)
        local a,b,cs,cslen ;
        a := 0 ;
        for b from 0 to 2^(n-1)-1 do
            cs := convert(b,base,2) ;
            cslen := nops(cs) ;
            if cslen < n-1 then
                cs := [op(cs),seq(0,i=1..n-1-cslen)] ;
            end if;
            if ithprime(4)+add( (-1+2*op(i-4,cs)) *ithprime(i),i=5..n+3) = 0 then
                a := a+1 ;
            end if;
        end do:
        a ;
    end proc:
    for n from 1 do
        print(n,A022903(n)) ;
    end do: # R. J. Mathar, Aug 06 2015
  • Mathematica
    {f, s} = {4, 0}; Table[t = Map[Prime[# + f - 1] &, Range[2, z]]; Count[Map[Apply[Plus, #] &, Map[t # &, Tuples[{-1, 1}, Length[t]]]], s - Prime[f]], {z, 22}]
    (* A022903, a(n) = number of solutions of "sum = s" using Prime(f) to Prime(f+n-1) *)
    n = 10; t = Map[Prime[# + f - 1] &, Range[n]]; Map[#[[2]] &, Select[Map[{Apply[Plus, #], #} &, Map[t # &, Map[Prepend[#, 1] &, Tuples[{-1, 1}, Length[t] - 1]]]], #[[1]] == s &]]  (* the 6 solutions of using n=10 primes; Peter J. C. Moses, Oct 01 2013 *)
  • PARI
    A022903(n, rhs=0, firstprime=4)={rhs-=prime(firstprime); my(p=vector(n-1, i, prime(i+firstprime))); sum(i=1, 2^#p-1, sum(j=1, #p, (-1)^bittest(i, j-1)*p[j])==rhs)} \\ For illustrative purpose, too slow for n >> 20. - M. F. Hasler, Aug 08 2015

Formula

a(2n-1) = 0 for all n >= 1 because an odd number of odd terms on the l.h.s. cannot sum to zero. - M. F. Hasler, Aug 08 2015
a(n) = [x^7] Product_{k=5..n+3} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 28 2024

Extensions

a(23)-a(49) from Alois P. Heinz, Aug 06 2015

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

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 2, 0, 7, 0, 19, 0, 63, 0, 197, 0, 645, 0, 2172, 0, 7423, 0, 25534, 0, 89218, 0, 317284, 0, 1130526, 0, 4033648, 0, 14515742, 0, 52625952, 0, 191790090, 0, 702333340, 0, 2585539586, 0, 9570549372, 0, 35562602950, 0, 131774529663, 0
Offset: 1

Views

Author

Keywords

Examples

			a(8) counts these 2 solutions: {3, 5, -7, 11, 13, 17, -19, -23}, {3, 5, 7, 11, -13, -17, -19, 23}. - _Clark Kimberling_, Oct 01 2013
		

Crossrefs

Cf. A083309 (without odd n).
Cf. A022894 (use all primes in the sum), A022895 (r.h.s. = 1), A022896 (r.h.s. = 2),..., A022903 (using primes >= 7), A022904, A022920; A261061 - A261063 and A261045 (r.h.s. = -1); A261057, A261059, A261060, A261044 (r.h.s. = -2).

Programs

  • Mathematica
    Table[ps = Prime[Range[2, n+1]]; pr = Inner[Times, 2 IntegerDigits[Range[2^(n-1), 2^n - 1], 2, n] - 1, ps, Plus]; Count[pr, 0], {n, 16}] (* T. D. Noe, Sep 30 2013 *)
  • PARI
    padbin(n, len) = {if (n, b = binary(n), b = [0]); while(length(b) < len, b = concat(0, b);); b;}
    a(n) = {nbs = 0; for (i = 2^(n-1), 2^n-1, vec = padbin(i, n); if (sum(k=1, n, if (vec[k], prime(k+1), -prime(k+1))) == 0, nbs++);); nbs;} \\ Michel Marcus, Sep 30 2013
    
  • PARI
    A022897(n, rhs=0, firstprime=2)={rhs-=prime(firstprime); my(p=vector(n-1, i, prime(i+firstprime))); sum(i=1, 2^#p-1, sum(j=1, #p, (-1)^bittest(i, j-1)*p[j])==rhs)} \\ For illustrative purpose, too slow for n >> 20. - M. F. Hasler, Aug 08 2015
    
  • PARI
    a(n, s=0-3, p=2)=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), sum(i=p+1, p+n-1, prime(i)), prime(p+n-1)))) \\ M. F. Hasler, Aug 09 2015

Formula

a(2n-1) = 0 (odd number of odd terms on the l.h.s.); a(2n) = A083309(n). - M. F. Hasler, Aug 08 2015
a(n) = [x^3] Product_{k=3..n+1} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 26 2024

Extensions

a(20)-a(24) from Michel Marcus, Sep 30 2013
More terms from T. D. Noe, Sep 30 2013

A367088 Number of solutions to +- 1 +- 2 +- 3 +- 5 +- 7 +- ... +- prime(n-1) = 0 or 1.

Original entry on oeis.org

1, 1, 1, 2, 2, 2, 3, 6, 7, 12, 19, 32, 53, 90, 156, 276, 493, 878, 1566, 2834, 5146, 9396, 17358, 32042, 59434, 110292, 204332, 380548, 713601, 1342448, 2538012, 4808578, 9043605, 17070234, 32268611, 61271738, 116123939, 220993892, 421000142, 802844420, 1534312896
Offset: 0

Views

Author

Ilya Gutkovskiy, Jan 26 2024

Keywords

Crossrefs

Showing 1-8 of 8 results.