login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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.
2
-1, 3, 7, 23, 3, 139, 5, 113, 1831, 7, 887, 1129, 11, 2477, 2971, 13, 5591, 1327, 17, 30593, 19333, 19, 15683, 81463, 28229, 31907, 23, 35617, 82073, 44293, 29, 34061, 89689, 162143, 31, 173359, 31397, 404597, 212701, 37, 542603, 265621, 41, 155921, 544279, 43, 927869, 1100977
OFFSET
0,2
COMMENTS
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.
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.
When a(n) <> -1, a(n) together with the next prime generate a satisfactory example for proving A362465(2n) = 2.
LINKS
Carlos Rivera, Conjecture 21. Rivera's conjecture, The Prime Puzzles and Problems Connection.
FORMULA
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).
a(n) = -1 if and only if A362465(2n) <> 2.
PROG
(Python)
from sympy import sieve as prime
def A363544(n):
if n == 0: return -1
k = 2
while (prime[k] + prime[k+1]) < 2*n and (prime[k] + prime[k+1]) // 2 != n: k += 1
if (prime[k] + prime[k+1]) // 2 == n: return prime[k]
k = 2
while (prime[k+1] - prime[k]) // 2 != n: k += 1
return prime[k]
print([A363544(n) for n in range(0, 50)])
KEYWORD
sign
AUTHOR
STATUS
approved