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.

A359199 Least prime p such that 2n can be written as a signed sum of p and the next 3 primes, or -1 if no such prime exists.

This page as a plain text file.
%I A359199 #63 Sep 19 2023 15:37:45
%S A359199 5,3,3,3,7,3,3,5,3,19,3,5,79,3,113,17,467,7,5,11,19,17,19,13,7,17,
%T A359199 1123,17,19,23,11,23,19,31,2153,31,13,23,29,31,29,37,43,37,17,31,
%U A359199 19081,37,43,41,19319,19,37897,53,43,54193,35671,47,43,53,23,53,59,47,35603,61
%N A359199 Least prime p such that 2n can be written as a signed sum of p and the next 3 primes, or -1 if no such prime exists.
%C A359199 We require each of the 4 primes to appear in the sum exactly once.
%C A359199 Inspired by the study of problems about the signed sum of consecutive primes, for example, by Rivera in 2000 (see link).
%C A359199 The equivalent sequence with 2 rather than 4 primes is A363544, which is closely related to A000230, which concerns prime gaps.
%C A359199 Conjecture: a satisfactory prime p exists for all n.
%C A359199 The magnitude of the terms exhibits a notable variation that depends on the number of negations in the sum. See the visualization in the links.
%C A359199 All odd primes appear in the sequence. When 2n = A034963(k) we see the last occurrence of the k-th prime. Obviously, these last occurrences correspond to the sums where all the signs are positive. Do any odd primes occur only once?
%H A359199 Karl-Heinz Hofmann, <a href="/A359199/b359199.txt">Table of n, a(n) for n = 0..532</a>
%H A359199 Carlos Rivera, <a href="https://www.primepuzzles.net/conjectures/conj_021.htm">Conjecture 21. Rivera's conjecture</a>, The Prime Puzzles and Problems Connection.
%H A359199 Karl-Heinz Hofmann, <a href="/A359199/a359199_1.txt">Solutions for n = 0 to 100.</a>
%H A359199 Karl-Heinz Hofmann, <a href="/A359199/a359199.png">Visualization of possible sums.</a>
%H A359199 Karl-Heinz Hofmann, <a href="/A359199/a359199_2.png">Visualization of possible sums and results.</a>
%F A359199 For k >= 2, a(A034963(k)/2) = A000040(k).
%e A359199 The signed sums of 2, 3, 5 and 7 are all odd, so cannot be 2n for any n. So all terms are >= 3, the 2nd prime.
%e A359199 The 16 possible signed sums of 3, 5, 7 and 11 give 8 nonnegative totals: 2, 4, 6, 10, 12, 16, 20, 26. So a(1) = a(2) = a(3) = a(5) = a(6) = a(8) = a(10) = a(13) = 3.
%e A359199 0 was not one of the 8 totals, and 0 = 5 - 7 - 11 + 13. So a(0) = 5.
%o A359199 (Python)
%o A359199 from sympy import nextprime
%o A359199 import numpy as np
%o A359199 aupto = 100
%o A359199 A359199 = np.zeros(aupto+1, dtype=object)
%o A359199 signset = np.array([[ 1,  1,  1,  1] , # green line in visualizations (see links)
%o A359199                     [ 1,  1,  1, -1] , # red ribbon
%o A359199                     [ 1,  1, -1,  1] , # red ribbon
%o A359199                     [ 1, -1,  1,  1] , # red ribbon
%o A359199                     [ 1,  1, -1, -1] , # magenta ribbon
%o A359199                     [ 1, -1,  1, -1] , # magenta ribbon
%o A359199                     [ 1, -1, -1,  1] , # magenta ribbon
%o A359199                     [ 1, -1, -1, -1]], # red ribbon
%o A359199                     dtype="i4")
%o A359199 primeset = np.array([3, 5, 7, 11], dtype=object)
%o A359199 while all(A359199) == 0:
%o A359199     for signs in signset:
%o A359199         asum = abs(sum(signs * primeset)) // 2
%o A359199         if asum <= aupto and A359199[asum] == 0: A359199[asum] = primeset[0]
%o A359199     primeset = np.append(primeset, nextprime(primeset[-1]))[1:]
%o A359199 print(list(A359199))
%Y A359199 Cf. A000040, A000230, A034963, A144103, A327467, A362465, A363544.
%K A359199 nonn
%O A359199 0,1
%A A359199 _Karl-Heinz Hofmann_ and _Peter Munn_, Jun 04 2023