A123556 Number of elements in longest possible arithmetic progression of primes with difference n.
2, 3, 2, 3, 2, 5, 1, 3, 2, 3, 2, 5, 1, 3, 2, 2, 2, 4, 1, 3, 2, 2, 1, 4, 1, 2, 2, 3, 2, 6, 1, 2, 1, 3, 2, 4, 1, 3, 2, 3, 2, 5, 1, 2, 2, 2, 1, 5, 1, 3, 2, 2, 1, 4, 1, 2, 2, 2, 2, 6, 1, 2, 1, 3, 2, 4, 1, 3, 2, 2, 2, 4, 1, 2, 1, 2, 2, 4, 1, 3, 2, 2, 1, 4, 1, 2, 2, 2, 1, 6, 1, 2, 1, 3, 2, 5, 1, 3, 2, 2, 2, 4, 1, 3, 2
Offset: 1
Keywords
Examples
a(1) = 2 for the AP (arithmetic progression) (2, 3) with A342309(1) = 2. a(2) = 3 for the AP (3, 5, 7) with A342309(2) = 3. a(3) = 2 for the AP (2, 5) with A342309(3) = 2. a(6) = 5 for the AP (5, 11, 17, 23, 29) with A342309(6) = 5. a(7) = 1 for the AP (2) with A342309(7) = 2. a(18) = 4 for the AP (5, 23, 41, 59) with A342309(18) = 5. a(30) = 6 for the AP (7, 37, 67, 97, 127, 157) with A342309(30) = 7. a(150) = 7 for the AP (7, 157, 307, 457, 607, 757, 907) with A342309(150) = 7. From _Bernard Schott_, Feb 25 2023: (Start) For n = 12, p = A053669(12) = 5 and the AP (5, 17, 29, 41, 53) has 5 elements that are primes (the next should be 65 = 5*13), so a(12) = 5. This AP is the unique longest possible AP of primes with a common difference n = 12. For n = 30, p = A053669(30) = 7 and the AP (7, 37, 67, 97, 127, 157) has 7-1 = 6 elements that are primes (the next should be 187 = 11*17) so a(30) = 6. Also, there are infinitely many such longest APs with common difference 30 and 6 elements. These other longest APs start with primes q that are > p = 7. The first few next q are 107, 359, 541, 2221, 6673, 7457, ... For n = 60, p = A053669(60) = 7 and the longest AP that starts with 7 is (7, 67, 127) has only 3 elements that are primes (the next should be 187 = 11*17) so a(60) = 6. Also, there are infinitely many such longest APs with common difference 60 and 6 elements. All these longest APs start with primes q that are > p = 7. The first few such q are 11, 53, 641, 5443, 10091, 12457, ... and the smallest such AP is (11, 71, 131, 191, 251, 311). (End)
Links
Crossrefs
Programs
-
PARI
A053669(n) = forprime(p=2, , if(n%p, return(p))); a(n) = my(p=A053669(n)); for (i=1, p-1, if (!isprime(p+i*n), return(p-1))); p; \\ Michel Marcus, Feb 26 2023
Formula
Assume the k-tuples conjecture. Let p = A053669(n). If the arithmetic progression of p elements starting at p with difference n consists of primes, then a(n) = p, otherwise a(n) = p-1.
Comments