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.
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
Keywords
Examples
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.
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.
Programs
-
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 *)
-
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
Comments