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.

A211889 Smallest positive d such that prime(n)+k*d is prime for 0 <= k <= n.

This page as a plain text file.
%I A211889 #25 Feb 16 2025 08:33:17
%S A211889 1,2,6,30,60,244230,6930,546840,3120613860,7399357350,10719893274090,
%T A211889 173761834256010,14772517344885300
%N A211889 Smallest positive d such that prime(n)+k*d is prime for 0 <= k <= n.
%C A211889 a(n) = A211890(n,k+1) - A211890(n,k), 0 <= k < n.
%H A211889 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimeArithmeticProgression.html">Prime Arithmetic Progression</a>.
%H A211889 Wikipedia, <a href="http://en.wikipedia.org/wiki/Primes_in_arithmetic_progression">Primes in arithmetic progression</a>.
%H A211889 <a href="/index/Pri#primes_AP">Index entries for sequences related to primes in arithmetic progressions</a>
%F A211889 A010051(A000040(n) + k * a(n)) = 1, 0 <= k <= n.
%o A211889 (Haskell)
%o A211889 a211889 n = head [k | let p = a000040 n, k <- [1..],
%o A211889             all ((== 1) . a010051') $ map ((+ p) . (* k)) (a002260_row n)]
%o A211889 (Python)
%o A211889 from sympy import isprime, prime, primorial, primepi
%o A211889 def A211889(n):
%o A211889     if n == 1:
%o A211889         return 1
%o A211889     delta = primorial(primepi(n))
%o A211889     p, d = prime(n), delta
%o A211889     while True:
%o A211889         q = p
%o A211889         for _ in range(n):
%o A211889             q += d
%o A211889             if not isprime(q):
%o A211889                 break
%o A211889         else:
%o A211889             return d
%o A211889         d += delta # _Chai Wah Wu_, Jun 28 2019
%Y A211889 Cf. A000040, A010051, A211890.
%K A211889 nonn,more
%O A211889 1,2
%A A211889 _Reinhard Zumkeller_, Jul 13 2012
%E A211889 a(10) from _Chai Wah Wu_, Jun 29 2019
%E A211889 a(11)-a(13) from _Giovanni Resta_, Jun 30 2019