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”).

A354370
Successive pairs of terms (i, j) such that (i + j) is a prime number and at least i is a prime number. This is the lexicographically earliest infinite sequence of distinct terms > 1 with this property.
4
2, 3, 5, 6, 7, 4, 11, 8, 13, 10, 17, 12, 19, 18, 23, 14, 29, 24, 31, 16, 37, 22, 41, 20, 43, 28, 47, 26, 53, 30, 59, 38, 61, 36, 67, 34, 71, 32, 73, 40, 79, 48, 83, 44, 89, 42, 97, 52, 101, 50, 103, 46, 107, 56, 109, 54, 113, 60, 127, 64, 131, 62, 137, 74, 139, 58, 149, 78, 151, 72, 157, 66, 163, 70
OFFSET
1,1
COMMENTS
The terms 1, 9, 15, 21, 25, 27, 33, 35, 39, 45, ... will never appear in the sequence; they form A014076, the "Odd nonprimes". Two prime terms can form a pair (2 and 3 for instance) but the first term must always be a prime [the pair (5, 6) is ok].
LINKS
Michael De Vlieger, Annotated log-log scatterplot of a(n), n = 1..10^4, showing records in red and local minima in blue, highlighting fixed points in gold and composite powers of 2 in magenta.
EXAMPLE
The earliest pairs with their prime sum: (2, 3) = 5, (5, 6) = 11, (7, 4) = 11, (11, 8) = 19, (13, 10) = 23, (17, 12) = 29, (19, 18) = 37, (23, 14) = 37, etc.
MATHEMATICA
nn = 120; c[_] = 0; a[1] = 2; c[2] = 1; u = 3; Do[If[EvenQ[i], k = u; While[Nand[c[k] == 0, PrimeQ[# + k]] &[a[i - 1]], k++], k = u; While[Nand[c[k] == 0, PrimeQ[k]], k++]]; Set[{a[i], c[k]}, {k, i}]; If[k == u, While[Or[c[u] > 0, And[OddQ[u], CompositeQ[u]]], u++]], {i, 2, nn}]; Array[a, nn] (* Michael De Vlieger, May 24 2022 *)
PROG
(Python)
from sympy import isprime
from itertools import islice
def agen(): # generator of terms
i, j, v, aset = 2, 3, 4, set()
while True:
aset.update((i, j)); yield from (i, j)
i = j = v
while i in aset or not isprime(i): i += 1
while j == i or j in aset or not isprime(i+j): j += 1
while v in aset: v += 1
print(list(islice(agen(), 74))) # Michael S. Branicky, Jun 24 2022
CROSSREFS
Cf. A354367, A354368, A354369 (same idea), A014076.
Sequence in context: A371257 A247891 A367407 * A113821 A319523 A255367
KEYWORD
nonn
AUTHOR
Eric Angelini and Carole Dubois, May 24 2022
STATUS
approved