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.

Showing 1-1 of 1 results.

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.

Original entry on oeis.org

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, 132, 46, 101, 158, 46, 99, 174, 64, 145, 27, 114, 193, 51, 144, 239, 93, 194, 24, 135, 244, 74, 179, 294, 116, 253, 43, 162, 291, 61, 196, 337, 101, 250, 395, 139, 282, 427, 149, 324
Offset: 0

Views

Author

Bob Andriesse, Aug 11 2019

Keywords

Comments

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

Examples

			a(2) = 2 + 3 - 5 = 0;
a(3) = 2 + 3 + 5 - 7 = 3;
a(6) = 2 + 3 + 5 + 7 + 11 + 13 - (17 + 19) = 5.
a(532)=0 because A007504(733) = 2*A007504(532).
		

Crossrefs

Programs

  • Python
    #Lists a(1)...a(100)
    from sympy import prime
    sumP=0
    for i in range(1,101):
      sumP+=prime(i)
      j=i+1
      diff=sumP
      while diff-prime(j) >=0:
       diff-=prime(j)
       j+=1
      print(diff, end=', ')
    
  • Python
    from itertools import islice
    from gmpy2 import next_prime
    def a309655_gen():
        lower_prime = upper_prime = difference = 0
        while True:
            while difference >= 0:
                upper_prime = next_prime(upper_prime)
                if difference < upper_prime:
                    yield int(difference)
                difference -= upper_prime
            lower_prime = next_prime(lower_prime)
            difference += 2 * lower_prime
    print(list(islice(a309655_gen(), 64))) # David Radcliffe, Jun 10 2025
Showing 1-1 of 1 results.