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.

A309655 The smallest possible nonnegative difference between the sum of the first n primes (A007504) and the sum of any number of the directly following and consecutive primes.

This page as a plain text file.
%I A309655 #28 Jun 10 2025 11:45:47
%S A309655 0,2,0,3,6,15,5,16,25,3,20,39,13,36,61,17,50,6,39,76,14,53,102,28,75,
%T A309655 132,46,101,158,46,99,174,64,145,27,114,193,51,144,239,93,194,24,135,
%U A309655 244,74,179,294,116,253,43,162,291,61,196,337,101,250,395,139,282,427,149,324
%N A309655 The smallest possible nonnegative difference between the sum of the first n primes (A007504) and the sum of any number of the directly following and consecutive primes.
%C A309655 Conjecture: a(0)=0, a(2)=0 and a(532)=0 are the only zeros in the sequence. a(n) has been computed for primes < 10^10. - _Bob Andriesse_, Oct 07 2020
%H A309655 David Radcliffe, <a href="/A309655/b309655.txt">Table of n, a(n) for n = 0..10000</a>
%e A309655 a(2) = 2 + 3 - 5 = 0;
%e A309655 a(3) = 2 + 3 + 5 - 7 = 3;
%e A309655 a(6) = 2 + 3 + 5 + 7 + 11 + 13 - (17 + 19) = 5.
%e A309655 a(532)=0 because A007504(733) = 2*A007504(532).
%o A309655 (Python)
%o A309655 #Lists a(1)...a(100)
%o A309655 from sympy import prime
%o A309655 sumP=0
%o A309655 for i in range(1,101):
%o A309655   sumP+=prime(i)
%o A309655   j=i+1
%o A309655   diff=sumP
%o A309655   while diff-prime(j) >=0:
%o A309655    diff-=prime(j)
%o A309655    j+=1
%o A309655   print(diff, end=', ')
%o A309655 (Python)
%o A309655 from itertools import islice
%o A309655 from gmpy2 import next_prime
%o A309655 def a309655_gen():
%o A309655     lower_prime = upper_prime = difference = 0
%o A309655     while True:
%o A309655         while difference >= 0:
%o A309655             upper_prime = next_prime(upper_prime)
%o A309655             if difference < upper_prime:
%o A309655                 yield int(difference)
%o A309655             difference -= upper_prime
%o A309655         lower_prime = next_prime(lower_prime)
%o A309655         difference += 2 * lower_prime
%o A309655 print(list(islice(a309655_gen(), 64))) # _David Radcliffe_, Jun 10 2025
%Y A309655 Cf. A007504, A309714.
%K A309655 nonn,look
%O A309655 0,2
%A A309655 _Bob Andriesse_, Aug 11 2019