login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I #23 Jun 25 2022 22:03:11

%S 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,

%T 28,47,26,53,30,59,38,61,36,67,34,71,32,73,40,79,48,83,44,89,42,97,52,

%U 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

%N 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.

%C 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].

%H Michael De Vlieger, <a href="/A354370/a354370.png">Annotated log-log scatterplot of a(n)</a>, 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.

%e 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.

%t 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 *)

%o (Python)

%o from sympy import isprime

%o from itertools import islice

%o def agen(): # generator of terms

%o i, j, v, aset = 2, 3, 4, set()

%o while True:

%o aset.update((i, j)); yield from (i, j)

%o i = j = v

%o while i in aset or not isprime(i): i += 1

%o while j == i or j in aset or not isprime(i+j): j += 1

%o while v in aset: v += 1

%o print(list(islice(agen(), 74))) # _Michael S. Branicky_, Jun 24 2022

%Y Cf. A354367, A354368, A354369 (same idea), A014076.

%K nonn

%O 1,1

%A _Eric Angelini_ and _Carole Dubois_, May 24 2022

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 28 06:27 EDT 2024. Contains 372020 sequences. (Running on oeis4.)