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.
%I A363544 #32 Jul 06 2023 16:57:28 %S A363544 -1,3,7,23,3,139,5,113,1831,7,887,1129,11,2477,2971,13,5591,1327,17, %T A363544 30593,19333,19,15683,81463,28229,31907,23,35617,82073,44293,29,34061, %U A363544 89689,162143,31,173359,31397,404597,212701,37,542603,265621,41,155921,544279,43,927869,1100977 %N A363544 Least prime p such that 2n can be written as the sum or absolute difference of p and the next prime, or -1 if no such prime exists. %C A363544 In recent years, a number of problems have been investigated that concern representing integers as the signed sum of consecutive prime numbers. See, for example, A327467 and the Rivera link. %C A363544 A000230, which concerns prime gaps, can be considered a more historic such sequence. Here we look at a minor generalization of A000230 in the spirit of signed sums. %C A363544 When a(n) <> -1, a(n) together with the next prime generate a satisfactory example for proving A362465(2n) = 2. %H A363544 Carlos Rivera, <a href="https://www.primepuzzles.net/conjectures/conj_021.htm">Conjecture 21. Rivera's conjecture</a>, The Prime Puzzles and Problems Connection. %F A363544 If 2n is in A001043 then a(n) = prime(k), where k is the position of 2n in A001043, otherwise for n > 0, a(n) = A000230(n). %F A363544 a(n) = -1 if and only if A362465(2n) <> 2. %o A363544 (Python) %o A363544 from sympy import sieve as prime %o A363544 def A363544(n): %o A363544 if n == 0: return -1 %o A363544 k = 2 %o A363544 while (prime[k] + prime[k+1]) < 2*n and (prime[k] + prime[k+1]) // 2 != n: k += 1 %o A363544 if (prime[k] + prime[k+1]) // 2 == n: return prime[k] %o A363544 k = 2 %o A363544 while (prime[k+1] - prime[k]) // 2 != n: k += 1 %o A363544 return prime[k] %o A363544 print([A363544(n) for n in range(0,50)]) %Y A363544 Cf. A000040, A000230, A001043, A001223, A327467, A359199, A362465. %K A363544 sign %O A363544 0,2 %A A363544 _Karl-Heinz Hofmann_ and _Peter Munn_, Jun 09 2023