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.

A226743 Number of alternating sums of consecutive primes with result 2n-1.

This page as a plain text file.
%I A226743 #12 Feb 06 2025 16:10:46
%S A226743 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,
%T A226743 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,
%U A226743 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
%N A226743 Number of alternating sums of consecutive primes with result 2n-1.
%C A226743 Since A008347 has no duplicate values, a(n) must be finite. This is not true for even results of the sum.
%C A226743 Sums of a single term are not included. - _Robert Israel_, Feb 06 2025
%H A226743 Robert Israel, <a href="/A226743/b226743.txt">Table of n, a(n) for n = 1..10000</a>
%e A226743 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.
%p A226743 N:= 100: M:= 2*N-1: # for a(1)..a(N)
%p A226743 p:= 1: b:= 0: B:= NULL:
%p A226743 for i from 1 do
%p A226743   p:= nextprime(p);
%p A226743   b:= b + (-1)^i*p;
%p A226743   B:= B,b;
%p A226743   if b > M then nB:= i; break fi;
%p A226743 od:
%p A226743 V:= Vector(M):
%p A226743 for j from 2 to nB by 2 while B[j] <= M do V[B[j]]:= 1 od:
%p A226743 for i from 1 to nB do
%p A226743   for j from i+3 to nB by 2 do
%p A226743     r:= abs(B[j]-B[i]);
%p A226743     if r <= M then V[r]:= V[r]+1 else break fi;
%p A226743 od od:
%p A226743 seq(V[i],i=1..M,2); # _Robert Israel_, Feb 06 2025
%o A226743 (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)))
%Y A226743 Cf. A084143.
%K A226743 nonn
%O A226743 1,3
%A A226743 _Ralf Stephan_, Sep 01 2013