Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #28 Feb 12 2021 12:14:32
%S 7,17,23,31,41,47,71,103,113,151,167,191,239,263,271,281,311,353,359,
%T 383,431,479,503,521,599,647,719,743,823,839,863,887,911,953,983,1031,
%U 1103,1151,1223,1319,1361,1367,1439,1487,1511,1559,1583,1607,1663,1823,1831,1847,1871,2039,2063,2087,2111
%N Primes r such that there exist primes p, q with p^2 - 2*q^2 = r.
%C If q is not 2 or 3, then r == 23 (mod 24).
%C The generalized Dickson conjecture implies that for any prime q there are infinitely many p for which p and p^2 - 2*q^2 are prime.
%C The least prime == 23 (mod 24) that is not in the sequence is 4079.
%C It appears that 5039 is also not in the sequence.
%H Jean-François Alcover, <a href="/A308816/b308816.txt">Table of n, a(n) for n = 1..586</a>
%H R. Israel et al., Mathematics StackExchange, <a href="https://math.stackexchange.com/questions/3274493/p2-2-q2-5039-for-primes-p-q">p^2 - 2 q^2 = 5039 for primes p,q</a>
%H Robert Israel, <a href="/A308816/a308816_2.txt">Possibly incomplete list of 1043 members of the sequence</a>
%H Robert Israel, <a href="/A308816/a308816_1.txt">Numbers that may or may not be in the sequence</a>
%e a(3) = 23 is in the sequence because 11^2 - 2*7^2 = 23 and 11, 7 and 23 are all primes.
%p # Note: a "false" result from the filter procedure for prime r == 23
%p # (mod 24) is not definitive. It is known that 4079 and 7703 are not in
%p # the sequence, but the status of 5039 has not been determined.
%p N:= 5000:
%p X1:= select(t -> isprime(t) and isprime(t^2-8), {seq(i,i=3..floor(sqrt(N+8)))}):
%p A1:= map(t -> t^2-8, X1):
%p X2:= select(t -> isprime(t) and isprime(t^2-18), {seq(i,i=3..floor(sqrt(N+18)))}):
%p A2:= map(t -> t^2-18, X2):
%p M:= <<3,2>|<4,3>>:
%p filter:= proc(r) local P1,S,C,k;
%p if not isprime(r) then return false fi;
%p P1:= select(t -> issqr(r+2*t^2), [$0..floor(2*sqrt(r))]);
%p S:= map(t -> <sqrt(r+2*t^2),t>, P1);
%p for k from 1 to 200 do
%p C:= select(t -> isprime(t[1]) and isprime(t[2]), S);
%p if C <> [] then return true fi;
%p S:= map(t -> M . t, S);
%p od;
%p false
%p end proc:
%p A3:= select(filter, {seq(i,i=23..N,24)}):
%p sort(convert(A1 union A2 union A3, list));
%t (* This empirical program confirms that, for instance, 2791 (p=53,q=3), 3463 (p=59,q=3), 5023 (p=71,q=3) and 6871 (p=83,q=3), are in the sequence. *)
%t kmax[10463 | 10799 | 14543 | 21599 | 34871 | 45263] = 40;
%t kmax[r_] = 12; (* kmax(r) is the maximum of Solve parameter C[1] *)
%t s[r_, k_] := Solve[p > 1 && q > 1 && p^2 - 2 q^2 == r, {p, q}, Primes] /. C[1] -> k // FullSimplify // DeleteCases[#, {p -> Undefined, q -> Undefined}]&;
%t filterQ[r_] := Module[{k, srk}, For[k = 1, k <= kmax[r], k++, srk = s[r, k]; If[srk != {} && FreeQ[srk, ConditionalExpression], Print[{r, k, srk, p^2 - 2 q^2 /. srk}]; Return[True]]]; False];
%t Select[Prime[Range[2, 5000]], filterQ] (* _Jean-François Alcover_, Oct 19 2020 *)
%K nonn
%O 1,1
%A _J. M. Bergot_ and _Robert Israel_, Jun 26 2019