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.

A240131 Least k such that prime(n)^2 + k^2 is prime, or 0 if none.

This page as a plain text file.
%I A240131 #21 Mar 22 2019 11:04:14
%S A240131 1,2,2,2,4,2,2,6,8,4,4,2,4,8,2,10,6,10,2,6,2,4,18,4,2,10,2,10,4,18,8,
%T A240131 16,2,10,14,4,10,2,2,10,4,6,4,2,8,16,4,18,8,4,2,10,16,14,18,8,10,6,2,
%U A240131 4,8,2,2,4,2,2,6,20,2,14,8,10,8,2,6,12,4,18,4,6,14,4,6,12,4,28,10,12,6,2,12,14,2,6,4,2,14,14,10,6
%N A240131 Least k such that prime(n)^2 + k^2 is prime, or 0 if none.
%C A240131 The main entry for this sequence is A240130.
%C A240131 k and p_n must be of opposite parity. Conjecture, there is always a k for any p_n. Tested for all primes < 15*10^10. - _Robert G. Wilson v_, Nov 04 2015
%C A240131 Least k > 0 for which prime(n)+i*k is a Gaussian prime. - _Robert Israel_, Nov 04 2015
%H A240131 Robert Israel, <a href="/A240131/b240131.txt">Table of n, a(n) for n = 1..10000</a>
%F A240131 a(n)^2 = A240130(n) - prime(n)^2 if a(n) > 0.
%e A240131 Prime(3) = 5 and 5^2 + 1^2 = 26 is not prime but 5^2 + 2^2 = 29 is prime, so a(3) = 2.
%p A240131 f:= proc(p) local k; for k from 2 by 2 do if isprime(p^2 + k^2) then return k fi eod nd proc:
%p A240131 f(2):= 1:
%p A240131 map(f, select(isprime, [2,seq(2*i+1,i=1..10000)])); # _Robert Israel_, Nov 04 2015
%t A240131 f[n_] := Block[{k = If[n == 1, 1, 2], p = Prime@ n}, While[ !PrimeQ[k^2 + p^2], k += 2]; k]; Array[f, 100]  (* _Robert G. Wilson v_, Nov 03 2015 *)
%t A240131 lk[n_]:=Module[{k=2,n2=n^2},While[!PrimeQ[n2+k^2],k+=2];k]; Join[{1}, Table[ lk[x],{x,Prime[Range[2,100]]}]] (* _Harvey P. Dale_, Mar 22 2019 *)
%o A240131 (PARI) vector(100, n, p = prime(n); k = 1 - p%2; inc = 2; while (!isprime(q=p^2+k^2), k += inc); k; ) \\ _Altug Alkan_, Nov 04 2015
%Y A240131 Cf. A240130.
%K A240131 nonn
%O A240131 1,2
%A A240131 _Jonathan Sondow_, Apr 07 2014