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.

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.

Original entry on oeis.org

-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

Views

Author

Karl-Heinz Hofmann and Peter Munn, Jun 09 2023

Keywords

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.

Crossrefs

Programs

  • 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)])

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.