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.

A172989 Smallest k such that the two numbers n^2 +- k are primes.

This page as a plain text file.
%I A172989 #27 Sep 08 2022 08:45:50
%S A172989 1,2,3,6,5,12,3,2,3,18,5,12,3,2,15,18,7,12,21,2,63,42,55,6,15,10,27,
%T A172989 12,19,78,15,2,93,12,5,78,15,10,21,12,23,18,57,14,27,30,7,120,117,8,
%U A172989 15,42,37,24,27,58,93,18,7,12,75,38,3,6,7,132,27,28,69,18,5,102,27,34,75,78,5
%N A172989 Smallest k such that the two numbers n^2 +- k are primes.
%H A172989 Hugo Pfoertner, <a href="/A172989/b172989.txt">Table of n, a(n) for n = 2..10000</a>
%F A172989 a(n) = A082467(n^2). - _Ivan N. Ianakiev_, Jul 28 2019
%e A172989 2^2 +- 1 are both prime, 3^2 +- 2 are both prime, 4^2 +- 3 are both prime, 5^2 +- 6 are both prime, ...
%t A172989 f[n_]:=Block[{k},If[OddQ[n],k=2,k=1];While[ !PrimeQ[n-k]||!PrimeQ[n+k],k+=2];k];Table[f[n^2],{n,2,40}]
%o A172989 (PARI) a(n) = my(k=1); while(!isprime(n^2+k) || !isprime(n^2-k), k++); k; \\ _Michel Marcus_, May 20 2018
%o A172989 (Magma) sol:=[]; for m in [2..80] do for k in [1..200] do if IsPrime(m^2-k) and IsPrime(m^2+k) then sol[m-1]:=k; break; end if; end for; end for; sol; // _Marius A. Burtea_, Jul 28 2019
%Y A172989 Cf. A060272 (at least one prime), A082467 (supersequence).
%K A172989 nonn
%O A172989 2,2
%A A172989 _Vladimir Joseph Stephan Orlovsky_, Feb 07 2010