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.

A359408 Integers d such that the longest possible arithmetic progression (AP) of primes with common difference d has only two elements.

Original entry on oeis.org

1, 3, 5, 9, 11, 15, 16, 17, 21, 22, 26, 27, 29, 32, 35, 39, 41, 44, 45, 46, 51, 52, 56, 57, 58, 59, 62, 65, 69, 70, 71, 74, 76, 77, 81, 82, 86, 87, 88, 92, 95, 99, 100, 101, 105, 105, 106, 107, 111, 112, 116, 118, 122, 125, 128, 129, 130, 135, 136, 137, 140, 142, 146, 147, 148, 149, 152, 155
Offset: 1

Views

Author

Bernard Schott, Dec 30 2022

Keywords

Comments

As '2 is prime' and also '2 is one less than prime 3' (see A173919), there exist two subsequences with k = 2 elements in these APs of primes (see examples).
1. If d is an odd term, then d is in A040976 \ {0} with d = prime(m) - 2, for some m >= 2, and, for each such d, there exists only one longest possible AP of primes, and this AP is always: (2, prime(m)) = (2, d+2), so starts with 2. This subsequence corresponds to the first case: '2 is prime'.
2. If d is an even term, then d is in A360735 and the longest corresponding APs of primes are of the form (q, q+d) with q odd primes. This subsequence corresponds to the second case '2 is one less than prime 3'.
A342309(d) gives the first element of the smallest AP with 2 elements whose common difference is a(n) = d.
The two elements of these APs are not necessarily consecutive primes.

Examples

			d = 1 is a term because the only longest AP of primes with common difference 1 is (2, 3) that has 2 elements because 4 is composite.
d = 3 is a term because the only longest AP of primes with common difference 3 is (2, 5) that has 2 elements because 8 is composite.
d = 5 is a term because the only longest AP of primes with common difference 5 is (2, 7) that has 2 elements because 12 is composite.
d = 16 is a term because the first longest APs of primes with common difference 16 are (3, 19), (7,23), (13, 29), ... that all have 2 elements; the first one that starts with A342309(16) = 3 is (3, 19).
d = 22 is a term because the first longest APs of primes with common difference 22 are (7, 29), (19, 41), (31, 53), ... that all have 2 elements; the first one that starts with A342309(22) = 7 is (7, 29).
		

Crossrefs

Equals disjoint union of A040976 \ {0} and A360735.
Longest AP of prime numbers with exactly k elements: A007921 (k=1), this sequence (k=2), A206037 (k=3), A359409 (k=4), A206039 (k=5), A359410 (k=6), A206041 (k=7), A360146 (k=10), A206045 (k=11)

Programs

  • Maple
    filter := d -> irem(d, 2) = 0 and irem(d, 3) <> 0 and not isprime(3+d) or irem(d, 2) = 0 and irem(d, 3) <> 0 and isprime(3+d) and not isprime(3+2*d) or isprime(d+2) : select(filter, [$(1 .. 155)]);
  • Mathematica
    Select[Range[155], Mod[#,2]==0 && Mod[#,3]!=0 && !PrimeQ[3+#] || Mod[#,2]==0 && Mod[#,3]!=0 && PrimeQ[3+#] && !PrimeQ[3+2#] || PrimeQ[#+2] &] (* Stefano Spezia, Jan 08 2023 *)

Formula

m is a term iff A123556(m) = 2.