Displaying 1-10 of 18 results found.
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.
+10
37
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
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.
FORMULA
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
EXAMPLE
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.
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):
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} ]
PROG
(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
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.
+10
27
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
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
EXAMPLE
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.
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
PROG
(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
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).
Number of solutions to c(1)*prime(4) + ... + c(n)*prime(n+3) = 2, where c(i) = +-1 for i > 1, c(1) = 1.
+10
20
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
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
FORMULA
a(2n-1) = 0 for all n >= 1.
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 *)
PROG
(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
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).
Number of solutions to c(1)*prime(1)+...+c(2n)*prime(2n) = -1, where c(i) = +-1 for i > 1, c(1) = 1.
+10
20
1, 0, 2, 3, 8, 23, 68, 221, 709, 2344, 8006, 27585, 95114, 335645, 1202053, 4267640, 15317698, 55248527, 200711160, 733697248, 2696576651, 9941588060, 36928160817, 136800727634, 508780005068, 1901946851732, 7133247301621, 26782446410398, 100862459737318
COMMENTS
There cannot be a solution for an odd number of terms on the l.h.s. because there would be an even number of odd terms but the r.h.s. is odd.
FORMULA
a(n) = [x^3] Product_{k=2..2*n} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 31 2024
EXAMPLE
a(1) = 1 counts the solution prime(1) - prime(2) = -1.
a(2) = 0 because prime(1) +- prime(2) +- prime(3) +- prime(4) is always different from -1.
a(3) = 2 counts the two solutions prime(1) - prime(2) + prime(3) - prime(4) - prime(5) + prime(6) = -1 and prime(1) - prime(2) - prime(3) + prime(4) + prime(5) - prime(6) = -1.
MAPLE
s:= proc(n) option remember;
`if`(n<2, 0, ithprime(n)+s(n-1))
end:
b:= proc(n, i) option remember; `if`(n>s(i), 0, `if`(i=1, 1,
b(abs(n-ithprime(i)), i-1)+b(n+ithprime(i), i-1)))
end:
a:= n-> b(3, 2*n):
MATHEMATICA
s[n_] := s[n] = If[n<2, 0, Prime[n]+s[n-1]]; b[n_, i_] := b[n, i] = If[n > s[i], 0, If[i == 1, 1, b[Abs[n-Prime[i]], i-1] + b[n+Prime[i], i-1]]]; a[n_] := b[3, 2*n]; Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Nov 11 2015, after Alois P. Heinz *)
PROG
(PARI) A261061(n, rhs=-1, firstprime=1)={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.
Number of solutions to c(1)*prime(1)+...+c(2n-1)*prime(2n-1) = -2, where c(i) = +-1 for i > 1, c(1) = 1.
+10
19
0, 0, 1, 1, 5, 13, 40, 123, 388, 1284, 4332, 14868, 51094, 178361, 634422, 2260717, 8066841, 29030051, 105247340, 383574146, 1404657053, 5171018981, 19140750300, 71124341227, 263546155710, 983417309702, 3684399940711, 13818092760075, 51937827473594, 195956606402526
COMMENTS
There cannot be a solution for an even number of terms on the l.h.s. because there would be an odd number of odd terms but the r.h.s. is even.
FORMULA
a(n) = [x^4] Product_{k=2..2*n-1} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 31 2024
EXAMPLE
a(1) = a(2) = 0 because prime(1) and prime(1) +- prime(2) +- prime(3) is always different from -2.
a(3) = 1 because prime(1) - prime(2) - prime(3) - prime(4) + prime(5) = -2.
MAPLE
s:= proc(n) option remember;
`if`(n<2, 0, ithprime(n)+s(n-1))
end:
b:= proc(n, i) option remember; `if`(n>s(i), 0, `if`(i=1, 1,
b(abs(n-ithprime(i)), i-1)+b(n+ithprime(i), i-1)))
end:
a:= n-> b(4, 2*n-1):
MATHEMATICA
s[n_] := s[n] = If[n<2, 0, Prime[n]+s[n-1]]; b[n_, i_] := b[n, i] = If[n > s[i], 0, If[i == 1, 1, b[Abs[n-Prime[i]], i-1] + b[n+Prime[i], i-1]]]; a[n_] := b[4, 2*n-1]; Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Nov 11 2015, after Alois P. Heinz *)
PROG
(PARI) A261057(n, rhs=-2, firstprime=1)={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.
(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, a(abs(s), max(sum(i=p+1, p+=2*n-2+bittest(s, 0), prime(i)), 1), prime(p))))} \\ M. F. Hasler, Aug 09 2015
Number of solutions to c(1)*prime(3) + ... + c(2n-1)*prime(2n+1) = -1, where c(i) = +-1 for i > 1, c(1) = 1.
+10
19
0, 0, 0, 1, 6, 8, 40, 67, 373, 1232, 3330, 13656, 47111, 164957, 582042, 1967152, 7129046, 26655235, 94956602, 353789267, 1300061367, 4765080122, 17726643505, 66038899483, 245431428625, 919911458949, 3457983108462, 12974054097333, 49016641868213, 185510228030858
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.
FORMULA
a(n) = [x^6] Product_{k=4..2*n+1} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 31 2024
EXAMPLE
a(1) = a(2) = 0 because prime(3) and prime(3) +- prime(4) +- prime(5) are different from -1 for any choice of the signs.
a(3) = 0 because the same sums prime(3) +- ... +- prime(7) is also always different from -1 for any choice of the signs.
a(4) = 1 because prime(3) - prime(4) - prime(5) - prime(6) - prime(7) + prime(8) + prime(9) = -1 is the only solution.
MAPLE
s:= proc(n) option remember;
`if`(n<4, 0, ithprime(n)+s(n-1))
end:
b:= proc(n, i) option remember; `if`(n>s(i), 0, `if`(i=3, 1,
b(abs(n-ithprime(i)), i-1)+b(n+ithprime(i), i-1)))
end:
a:= n-> b(6, 2*n+1):
MATHEMATICA
s[n_] := s[n] = If[n<4, 0, Prime[n]+s[n-1]]; b[n_, i_] := b[n, i] = If[n > s[i], 0, If[i == 3, 1, b[Abs[n-Prime[i]], i-1] + b[n+Prime[i], i-1]]]; a[n_] := b[6, 2*n+1]; Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Nov 11 2015, after Alois P. Heinz *)
PROG
(PARI) A261063(n, rhs=-1, firstprime=3)={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.
Number of solutions to c(1)*prime(2)+...+c(2n)*prime(2n+1) = -2, where c(i) = +-1 for i > 1, c(1) = 1.
+10
18
1, 0, 2, 1, 4, 25, 47, 237, 562, 1965, 7960, 24148, 85579, 307569, 1104519, 4106381, 14710760, 52113647, 193181449, 698356631, 2574590311, 9600573372, 35644252223, 131545038705, 492346772797, 1843993274342, 6903884199622, 25984680496124, 97937400336407
COMMENTS
There cannot be a solution for an odd number of terms on the l.h.s. because all terms are odd but the r.h.s. is even.
FORMULA
a(n) = [x^5] Product_{k=3..2*n+1} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 31 2024
EXAMPLE
a(1) = 1 because prime(2) - prime(3) = -2.
a(2) = 0 because prime(2) +- prime(3) +- prime(4) +- prime(5) is different from -2 for any choice of the signs.
a(3) = 2 counts the 2 solutions prime(2) - prime(3) + prime(4) - prime(5) - prime(6) + prime(7) = -2 and prime(2) - prime(3) - prime(4) + prime(5) + prime(6) - prime(7) = -2.
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(5, 2*n+1):
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[5, 2*n+1]; Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Nov 11 2015, after Alois P. Heinz *)
PROG
(PARI) A261059(n, rhs=-2, 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.
(PARI) a(n, s=-2-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+2*n-1, prime(i)), prime(p+n*2-1))))
Number of solutions to c(1)*prime(3) + ... + c(2n)*prime(2n+2) = -2, where c(i) = +-1 for i > 1, c(1) = 1.
+10
18
1, 0, 2, 1, 9, 22, 38, 143, 676, 1815, 7434, 22452, 87485, 290873, 1092072, 3894381, 13988849, 49672279, 184745525, 677809709, 2495632892, 9260315018, 34280441347, 127419049587, 474867366809, 1781565475308, 6700749901259, 25230023849115, 95215110677472
COMMENTS
There cannot be a solution for an odd number of terms on the l.h.s. because all terms are odd but the r.h.s. is even.
FORMULA
a(n) = [x^7] Product_{k=4..2*n+2} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 31 2024
EXAMPLE
a(1) = 1 because prime(3) - prime(4) = -2.
a(2) = 0 because prime(3) +- prime(4) +- prime(5) +- prime(6) is different from -2 for any choice of the signs.
a(3) = 2 counts the two solutions prime(3) - prime(4) + prime(5) - prime(6) - prime(7) + prime(8) = 5 - 7 + 11 - 13 - 17 + 19 = -2 and prime(3) - prime(4) - prime(5) + prime(6) + prime(7) - prime(8) = 5 - 7 - 11 + 13 + 17 - 19 = -2.
MAPLE
s:= proc(n) option remember;
`if`(n<4, 0, ithprime(n)+s(n-1))
end:
b:= proc(n, i) option remember; `if`(n>s(i), 0, `if`(i=3, 1,
b(abs(n-ithprime(i)), i-1)+b(n+ithprime(i), i-1)))
end:
a:= n-> b(7, 2*n+2):
MATHEMATICA
s[n_] := s[n] = If[n<4, 0, Prime[n]+s[n-1]]; b[n_, i_] := b[n, i] = If[n > s[i], 0, If[i == 3, 1, b[Abs[n-Prime[i]], i-1]+b[n+Prime[i], i-1]]]; a[n_] := b[7, 2*n+2]; Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Nov 11 2015, after Alois P. Heinz *)
PROG
(PARI) a(n, rhs=-2, firstprime=3)={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.
Number of solutions to +-p(1)+-p(2)+-...+-p(2n)=1 where p(i) is the i-th prime.
+10
17
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
COMMENTS
+-p(1)+-p(2)+-...+-p(2n+1)=1 has no solutions because the l.h.s. is even.
FORMULA
a(n) = [x^1] Product_{k=1..2*n} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 25 2024
EXAMPLE
2 + 3 + 5 - 7 + 11 - 13 = - 2 + 3 + 5 - 7 - 11 + 13 = - 2 + 3 - 5 + 7 + 11 - 13 = 1 so a(3) = 3.
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):
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 *)
Number of solutions to c(1)*prime(4)+...+c(n)*prime(n+3) = -2, where c(i) = +-1 for i > 1, c(1) = 1.
+10
17
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
COMMENTS
Each second entry is 0 because the terms on the l.h.s. are all odd and the r.h.s. is even.
FORMULA
a(2n-1) = 0 for all n >= 1.
EXAMPLE
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.
PROG
(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.
Search completed in 0.012 seconds
|