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

A261044 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, 2, 0, 5, 0, 18, 0, 48, 0, 170, 0, 540, 0, 1868, 0, 6385, 0, 22247, 0, 79355, 0, 282754, 0, 1008714, 0, 3627599, 0, 13156851, 0, 47949883, 0, 175599692, 0, 646384942, 0, 2392644640, 0, 8890619925, 0, 32943781423, 0, 122928406923, 0
Offset: 1

Views

Author

M. F. Hasler, Aug 08 2015

Keywords

Comments

Each second entry is 0 because the terms on the l.h.s. are all odd and the r.h.s. is even.

Examples

			a(8) = 2 counts the two solutions prime(4) - prime(5) + prime(6) - prime(7) - prime(8) + prime(9) - prime(10) + prime(11) = -2 and prime(4) - prime(5) - prime(6) + prime(7) + prime(8) - prime(9) - prime(10) + prime(11) = -2.
		

Crossrefs

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

Programs

  • PARI
    A261044(n, rhs=-2, 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 >> 10.

Formula

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

Extensions

a(25)-a(49) from Alois P. Heinz, Aug 08 2015

A083527 a(n) is the number of times that sums 1+-4+-9+-16+-...+-n^2 of the first n squares is zero. There are 2^(n-1) choices for the sign patterns.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 5, 0, 0, 43, 57, 0, 0, 239, 430, 0, 0, 2904, 5419, 0, 0, 27813, 50213, 0, 0, 348082, 649300, 0, 0, 3913496, 7287183, 0, 0, 50030553, 93696497, 0, 0, 611793542, 1161079907, 0, 0, 8009933135, 15176652567, 0, 0
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.
a(n) is the maximal number of subsets of the first n squares that share the same sum. Cf. A025591, A083309.
a(n)=0 when n==1 or 2 (mod 4).

Examples

			a(7) = 1 because there is only one sign pattern of the first seven squares that yields zero: 1+4-9+16-25-36+49.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i) option remember; local m;
          m:= (1+(3+2*i)*i)*i/6;
          `if`(n>m, 0, `if`(n=m, 1, b(abs(n-i^2), i-1) +b(n+i^2, i-1)))
        end:
    a:= n-> `if`(irem(n-1, 4)<2, 0, b(n^2, n-1)):
    seq(a(n), n=1..40);  # Alois P. Heinz, Oct 31 2011
  • Mathematica
    d={1, 1}; nMax=60; zeroLst={0}; Do[p=n^2; d=PadLeft[d, Length[d]+p]+PadRight[d, Length[d]+p]; If[1==Mod[Length[d], 2], AppendTo[zeroLst, d[[(Length[d]+1)/2]]], AppendTo[zeroLst, 0]], {n, 2, nMax}]; zeroLst/2
    p = 1; t = {}; Do[p = Expand[p(x^(n^2) + x^(-n^2))]; AppendTo[t, Select[p, NumberQ[ # ] &]/2], {n, 51}]; t (* Robert G. Wilson v, Oct 31 2005 *)
  • PARI
    a(n)=sum(i=0,2^(n-1)-1,sum(j=1,n-1,(-1)^bittest(i,j-1)*j^2)==n^2) \\ Charles R Greathouse IV, Nov 05 2012

Formula

a(n) is half the coefficient of x^0 in the product_{k=1..n} x^(k^2)+x^(k^-2).
a(n) = A158092(n)/2.
a(n) = [x^(n^2)] Product_{k=1..n-1} (x^(k^2) + 1/x^(k^2)). - Ilya Gutkovskiy, Feb 01 2024

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

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 0, 3, 0, 8, 0, 22, 0, 70, 0, 218, 0, 708, 0, 2354, 0, 8015, 0, 27561, 0, 95160, 0, 335579, 0, 1202236, 0, 4267477, 0, 15318171, 0, 55248419, 0, 200711050, 0, 733704990, 0, 2696599982, 0, 9941660942, 0, 36928370497, 0, 136801720627, 0
Offset: 1

Views

Author

Keywords

Examples

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

Crossrefs

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

Programs

  • Mathematica
    {f, s} = {1, 1}; 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}]
    (* A022895, a(n) = number of solutions of "sum = s" using Prime(f) to Prime(f+n-1) *)
    n = 8; 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 3 solutions using n=8 primes; Peter J. C. Moses, Oct 01 2013 *)
  • PARI
    A022895(n, rhs=1, firstprime=1)={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=1-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)))} \\ On function call, s = r.h.s.- smallest prime; during recursion: sum of all primes to be used. - M. F. Hasler, Aug 09 2015

Formula

a(n) = [x^1] 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
Cross-references from M. F. Hasler, Aug 08 2015

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

A059871 Number of solutions to the equation p_i = (1+mod(i,2))*p_{i-1} +- p_{i-2} +- p_{i-3} +- ... +- 2 +- 1, where p_i is the i-th prime number (where p_1 = 2 and the "zeroth prime" p_0 is defined to be 1).

Original entry on oeis.org

1, 1, 1, 1, 1, 3, 3, 4, 6, 12, 16, 31, 46, 90, 140, 276, 449, 877, 1443, 2834, 4725, 9395, 16153, 32037, 55872, 110288, 190815, 380488, 672728, 1342395, 2434797, 4808180, 8579625, 17070112, 30858078, 61271317, 110926277, 220979544, 402354848
Offset: 1

Views

Author

Antti Karttunen, Feb 05 2001

Keywords

Comments

In Burton's book it is said that it is "known" that each prime can be represented as such sum. However, I do not know whether that means it has been proved.
This is Scherk's theorem, which was conjectured by Scherk in 1833 and proved by Pillai in 1928. [T. D. Noe, Oct 03 2008]

Examples

			For the first five primes we have only one solution for each: 2 = 2*1, 3 = 1*2 + 1*1, 5 = 2*3 - 1*2 + 1*1, 7 = 1*5 + 1*3 - 1*2 + 1*1, 11 = 2*7 - 1*5 + 1*3 - 1*2 + 1*1 and for the next prime 13, we have 3 solutions: 13 = 11-7+5+3+2-1 = 11+7-5-3+2+1 = 11+7-5+3-2-1.
		

References

  • D. M. Burton, Elementary Number Theory.
  • S. S. Pillai, "On some empirical theorem of Scherk", J. Indian Math. Soc. 17 (1927-28), pp. 164-171.
  • W. Sierpiński, Elementary Theory of Numbers, Warszawa, 1964.

Crossrefs

See A059872 for the table of all solutions encoded as binary vectors and A059873-A059875 for specific sequences. A059876 gives the function bin_prime_sum.

Programs

  • Maple
    map(nops, primesums_primes_mult(16)); primesums_primes_mult := proc(upto_n) local a,b,i,n,p,t; a := []; for n from 1 to upto_n do b := []; p := ithprime(n); for i from (2^(n-1)) to ((2^n)-1) do t := bin_prime_sum(i); if(t = p) then b := [op(b),i]; fi; od; a := [op(a),b]; print(a); od; RETURN(a); end;
    # second Maple program
    p:= n-> `if`(n<0, 0, `if`(n=0, 1, ithprime(n))):
    sp:= proc(n) sp(n):= `if`(n<0, 0, p(n)+sp(n-1)) end:
    b := proc(n, i) option remember; `if`(n>sp(i), 0, `if`(i<0, 1,
            b(n+p(i), i-1)+ b(abs(n-p(i)), i-1)))
         end:
    a:= n-> b(p(n) -(1+irem(n, 2))*p(n-1), n-2):
    seq(a(n), n=1..40);  # Alois P. Heinz, Aug 05 2012
  • Mathematica
    nmax = 40; d = {1}; a1 = {}; pp = 1;
    Do[
      p = Prime[n];
      i = Ceiling[Length[d]/2] +  Abs[p - (1 + Mod[n, 2])*pp];
      AppendTo[a1, If[i > Length[d], 0, d[[i]]]];
      d = PadLeft[d, Length[d] + 2 pp] + PadRight[d, Length[d] + 2 pp];
      pp = p;
      , {n, nmax}];
    a1 (* Ray Chandler, Mar 11 2014 *)

Extensions

More terms from Naohiro Nomoto, Sep 11 2001
More terms from Larry Reeves (larryr(AT)acm.org), Nov 20 2003
a(33)-a(39) from Donovan Johnson, Oct 01 2010

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

Original entry on oeis.org

0, 2, 1, 7, 15, 45, 139, 438, 1419, 4703, 16019, 55146, 190254, 671215, 2404179, 8534995, 30635448, 110495549, 401418693, 1467388464, 5393131894, 19883104535, 73856058401, 273600682457, 1017557492609, 3803885439979, 14266466901249, 53564801078049
Offset: 1

Views

Author

Floor van Lamoen, Oct 12 2005

Keywords

Comments

+-p(1)+-p(2)+-...+-p(2n+1) = 3 does not have solutions, since the left hand side is even. [Corrected and edited by M. F. Hasler, Aug 09 2015]

Crossrefs

Cf. A022894 - A022904, A022920, A083309; A261061 - A261063 and A261045 (r.h.s. = -1); A261057, A261059, A261060 and A261044 (r.h.s. = -2); A113040, A113041.

Programs

  • Maple
    A113042:=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,3); 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(3, 2*n):
    seq(a(n), n=1..30);  # Alois P. Heinz, Aug 05 2012
  • 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 + Prime[i], i-1] + b[Abs[n - Prime[i]], i-1]]]; a[n_] := b[3, 2*n]; Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Jan 31 2017, after Alois P. Heinz *)

Formula

a(n) = [x^3] Product_{k=1..2*n} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 30 2024

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

Original entry on oeis.org

1, 0, 1, 3, 9, 27, 78, 249, 782, 2574, 8676, 29714, 102162, 356797, 1268990, 4521769, 16134137, 58061535, 210499244, 767154326, 2809323733, 10342098153, 38281849044, 142249547127, 527095215036, 1966843667482, 7368829743507, 27636276043171, 103876045792060
Offset: 1

Views

Author

Floor van Lamoen, Oct 12 2005

Keywords

Comments

+-p(1)+-p(2)+-...+-p(2n) = 2 has no solutions, since the left hand side is odd.

Crossrefs

Cf. A022894 - A022904, A022920, A083309; A261061 - A261063 and A261045 (r.h.s. = -1); A261057, A261059, A261060 and A261044 (r.h.s. = -2); A113040, A113042.

Programs

  • Maple
    A113041:=proc(n) local i,j,p,t; t:= NULL; for j to 2*n-1 by 2 do p:=1; for i to j do p:=p*(x^(-ithprime(i))+x^(ithprime(i))); od; t:=t,coeff(p,x,2); 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(2, 2*n-1):
    seq(a(n), n=1..30);  # Alois P. Heinz, Aug 05 2012
  • 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 + Prime[i], i-1] + b[Abs[n - Prime[i]], i-1]]];
    a[n_] := b[2, 2n-1];
    Array[a, 30] (* Jean-François Alcover, Nov 02 2020, after Alois P. Heinz *)

Formula

a(n) = A022896(2n-1) + A261057(n). - M. F. Hasler, Aug 09 2015
a(n) = [x^2] Product_{k=1..2*n-1} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 30 2024

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

Original entry on oeis.org

0, 0, 1, 0, 6, 8, 30, 121, 385, 1102, 4207, 13263, 48904, 164298, 610450, 2108897, 7592564, 27444148, 100851443, 365507140, 1344593522, 4960584613, 18435632285, 68320148701, 254166868115, 951593812462, 3568369245595, 13386056545363, 50416752718382
Offset: 1

Views

Author

M. F. Hasler, Aug 08 2015

Keywords

Comments

There cannot be a solution for an even number of terms on the l.h.s. because all terms are odd but the r.h.s. is odd, too.

Examples

			a(1) = a(2) = 0 because prime(2) and prime(2) +- prime(3) +- prime(4) are always different from -1.
a(3) = 1 because the solution prime(2) + prime(3) - prime(4) + prime(5) - prime(6) = -1 is the only one involving prime(2) through prime(6).
		

Crossrefs

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

Programs

  • Maple
    s:= proc(n) option remember;
          `if`(n<3, 0, ithprime(n)+s(n-1))
        end:
    b:= proc(n, i) option remember; `if`(n>s(i), 0, `if`(i=2, 1,
          b(abs(n-ithprime(i)), i-1)+b(n+ithprime(i), i-1)))
        end:
    a:= n-> b(4, 2*n):
    seq(a(n), n=1..30);  # Alois P. Heinz, Aug 08 2015
  • Mathematica
    s[n_] := s[n] = If[n < 3, 0, Prime[n] + s[n-1]];
    b[n_, i_] := b[n, i] = If[n > s[i], 0, If[i == 2, 1, b[Abs[n-Prime[i]], i-1] + b[n+Prime[i], i-1]]];
    a[n_] := b[4, 2n];
    Array[a, 30] (* Jean-François Alcover, Nov 07 2020, after Alois P. Heinz *)
  • PARI
    A261062(n,rhs=-1,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.

Formula

a(n) = [x^4] Product_{k=3..2*n} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 31 2024

Extensions

a(14)-a(29) from Alois P. Heinz, Aug 08 2015
Previous Showing 11-20 of 26 results. Next