login
A226743
Number of alternating sums of consecutive primes with result 2n-1.
1
1, 1, 2, 2, 3, 1, 2, 3, 2, 3, 5, 4, 4, 4, 5, 4, 5, 5, 4, 6, 5, 4, 9, 5, 5, 7, 6, 6, 10, 7, 9, 5, 11, 6, 6, 9, 8, 8, 9, 9, 9, 12, 8, 8, 10, 7, 9, 9, 12, 11, 8, 11, 12, 6, 10, 6, 8, 14, 10, 12, 13, 10, 11, 5, 11, 9, 11, 16, 11, 11, 14, 10, 10, 13, 10, 17, 12, 11, 18, 13, 13, 11, 18, 11, 13, 12, 14, 16, 17, 14, 10, 15, 11, 12
OFFSET
1,3
COMMENTS
Since A008347 has no duplicate values, a(n) must be finite. This is not true for even results of the sum.
Sums of a single term are not included. - Robert Israel, Feb 06 2025
LINKS
EXAMPLE
n=5: 11-7+5=2*5-1, 13-11+7=2*5-1, 19-17+13-11+7-5+3=2*5-1, so a(5)=3.
MAPLE
N:= 100: M:= 2*N-1: # for a(1)..a(N)
p:= 1: b:= 0: B:= NULL:
for i from 1 do
p:= nextprime(p);
b:= b + (-1)^i*p;
B:= B, b;
if b > M then nB:= i; break fi;
od:
V:= Vector(M):
for j from 2 to nB by 2 while B[j] <= M do V[B[j]]:= 1 od:
for i from 1 to nB do
for j from i+3 to nB by 2 do
r:= abs(B[j]-B[i]);
if r <= M then V[r]:= V[r]+1 else break fi;
od od:
seq(V[i], i=1..M, 2); # Robert Israel, Feb 06 2025
PROG
(PARI) vb=vecsmall(500); for(k=2, 1000, forstep(l=k-1, 1, -1, t=sum(i=l, k, prime(i)*(-1)^(k-i)); if(t<500, vb[t]=vb[t]+1)))
CROSSREFS
Cf. A084143.
Sequence in context: A282863 A308662 A284051 * A166269 A181648 A182910
KEYWORD
nonn
AUTHOR
Ralf Stephan, Sep 01 2013
STATUS
approved