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.
%I A354376 #53 May 29 2022 08:08:45 %S A354376 2,3,7,43,29,157,907,2351,5179,2089,375607,262897,725663,36850999, %T A354376 173471351,198793279,4827507229,17010526363,83547839407,572945039351, %U A354376 6269243827111 %N A354376 Smallest prime which is at the end of an arithmetic progression of exactly n primes. %C A354376 Equivalently: Let i, i+d, i+2d, ..., i+(n-1)d be an arithmetic progression of exactly n primes; choose the one which minimizes the last term; then a(n) = last term i+(n-1)d. %C A354376 The word "exactly" requires both i-d and i+n*d to be nonprime; without "exactly", we get A005115. %C A354376 For the corresponding values of the first term, and the common difference, see A354377 and A354484. For the actual arithmetic progressions, see A354485. %C A354376 The primes in these arithmetic progressions need not be consecutive. (The smallest prime at the start of a run of exactly n consecutive primes in arithmetic progression is A006560(n).) %C A354376 a(n) != A005115(n), because A005115(n) + A093364(n) is prime for n = 4, 8, 9, 11. - _Michael S. Branicky_, May 24 2022 %D A354376 R. K. Guy, Unsolved Problems in Number Theory, A5, Arithmetic progressions of primes. %e A354376 The arithmetic progression (5, 11, 17, 23) with common difference 6 contains 4 primes, but 29 = 23+6 is also prime, hence a(4) != 23. %e A354376 The arithmetic progression (7, 19, 31, 43) with common difference 12 also contains 4 primes, and 7-12 < 0 and 43+12 = 55 is composite; moreover this arithmetic progression is the smallest such progression with exactly 4 primes, hence a(4) = 43. %o A354376 (Python) %o A354376 from sympy import isprime, nextprime %o A354376 def a(n): %o A354376 if n < 3: return [2, 3][n-1] %o A354376 p = 2 %o A354376 while True: %o A354376 for d in range(2, (p-3)//(n-1)+1, 2): %o A354376 if isprime(p+d) or isprime(p-n*d): continue %o A354376 if all(isprime(p-j*d) for j in range(1, n)): return p %o A354376 p = nextprime(p) %o A354376 print([a(n) for n in range(1, 11)]) # _Michael S. Branicky_, May 24 2022 %Y A354376 Cf. A005115, A006560, A093364, A354377, A354484, A354485. %K A354376 nonn,more %O A354376 1,1 %A A354376 _Bernard Schott_, May 24 2022 %E A354376 a(4) corrected and a(8)-a(13) from _Michael S. Branicky_, May 24 2022 %E A354376 a(14)-a(21) derived using A005115 and A093364 by _Michael S. Branicky_, May 24 2022