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.

A163981 a(n) is the smallest prime of the form prime(n+1)*k - prime(n), k >= 1, where prime(n) is the n-th prime.

This page as a plain text file.
%I A163981 #25 Jul 02 2021 16:40:18
%S A163981 7,2,2,37,2,89,2,73,151,2,43,127,2,239,59,419,2,73,359,2,401,419,1163,
%T A163981 881,307,2,967,2,569,3697,397,691,2,457,2,163,821,839,179,1259,2,2111,
%U A163981 2,1777,2,223,3803,3863,2,3499,1201,2,2269,263,269,1889,2,283,1409,2,2647
%N A163981 a(n) is the smallest prime of the form prime(n+1)*k - prime(n), k >= 1, where prime(n) is the n-th prime.
%C A163981 a(n) = 2 if and only if n is in A029707. - _Robert Israel_, Jan 16 2019
%H A163981 Robert Israel, <a href="/A163981/b163981.txt">Table of n, a(n) for n = 1..10000</a>
%p A163981 a := proc (n) local k: for k while isprime(ithprime(n+1)*k-ithprime(n)) = false do end do: ithprime(n+1)*k-ithprime(n) end proc: seq(a(n), n = 1 .. 65); # _Emeric Deutsch_, Aug 10 2009
%t A163981 a[n_] := Module[{p, q, r}, For[p = Prime[n]; q = Prime[n + 1]; k = 1, True, k++, If[PrimeQ[r = q k - p], Return[r]]]];
%t A163981 Array[a, 100] (* _Jean-François Alcover_, Aug 28 2020 *)
%o A163981 (Python)
%o A163981 from sympy import isprime, nextprime, prime
%o A163981 def a(n):
%o A163981     pn = prime(n); pn1 = nextprime(pn); k = 1
%o A163981     while not isprime(pn1*k - pn): k += 1
%o A163981     return pn1*k - pn
%o A163981 print([a(n) for n in range(1, 62)]) # _Michael S. Branicky_, Jul 02 2021
%o A163981 (PARI) a(n) = my(k=1); while (!isprime(p=prime(n+1)*k - prime(n)), k++); p; \\ _Michel Marcus_, Jul 02 2021
%Y A163981 Cf. A029707, A129919.
%Y A163981 Contains A085704.
%K A163981 nonn
%O A163981 1,1
%A A163981 _Leroy Quet_, Aug 07 2009
%E A163981 Extended by _Emeric Deutsch_, Aug 10 2009