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.

A354369 Successive pairs of terms (a, b) such that (a + b) is a prime number and at least one of a and b is a prime number. This is the lexicographically earliest infinite sequence of distinct terms > 0 with this property.

This page as a plain text file.
%I A354369 #17 Jun 25 2022 22:02:09
%S A354369 1,2,3,4,5,6,7,10,8,11,12,17,13,16,14,23,18,19,20,41,22,31,24,29,26,
%T A354369 47,28,43,30,37,32,71,34,67,36,53,38,59,40,61,42,89,44,83,46,103,48,
%U A354369 79,50,101,52,97,54,73,56,107,58,109,60,113,62,131,64,127,66,157,68,173,70,163,72,139,74,137
%N A354369 Successive pairs of terms (a, b) such that (a + b) is a prime number and at least one of a and b is a prime number. This is the lexicographically earliest infinite sequence of distinct terms > 0 with this property.
%C A354369 The terms 9, 15, 21, 25, 27, 33, 35, 39, 45, 49, 51, ... will never appear in the sequence; they form A071904, the "Odd composite numbers".
%H A354369 Michael De Vlieger, <a href="/A354369/a354369.png">Annotated log-log scatterplot of a(n)</a>, n = 1..10^4, showing records in red, local minima in blue, composite powers of 2 in magenta, and fixed points in gold.
%e A354369 The earliest pairs with their prime sum: (1, 2) = 3, (3, 4) = 7, (5, 6) = 11, (7, 10) = 17, (8, 11) = 19, (12, 17) = 29, (13, 16) = 29, (14, 23) = 37, etc.
%t A354369 nn = 120; c[_] = 0; a[1] = c[1] = 1; u = 2; Do[k = u; If[EvenQ[i], While[Nand[c[k] == 0, PrimeQ[# + k]] &[a[i - 1]], 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 A354369 (Python)
%o A354369 from sympy import isprime
%o A354369 from itertools import islice
%o A354369 def agen(): # generator of terms
%o A354369     i, j, v, aset = 1, 2, 3, set()
%o A354369     while True:
%o A354369         aset.update((i, j)); yield from (i, j)
%o A354369         i = v
%o A354369         while i in aset or (i%2 == 1 and not isprime(i)):
%o A354369             i += 1
%o A354369         j, p = v, isprime(i)
%o A354369         while j==i or j in aset or not (isprime(i+j) and (p or isprime(j))):
%o A354369             j += 1
%o A354369         while v in aset: v += 1
%o A354369 print(list(islice(agen(), 74))) # _Michael S. Branicky_, Jun 24 2022
%Y A354369 Cf. A354367, A354368, A354370 (same idea), A071904.
%K A354369 nonn
%O A354369 1,2
%A A354369 _Eric Angelini_ and _Carole Dubois_, May 24 2022