%I M0607 N0219 #43 Oct 27 2019 14:06:28
%S 2,3,5,5,7,7,7,11,9,9,11,13,11,11,15,13,13,13,17,15,19,15,19,17,21,17,
%T 19,17,17,19,21,25,19,19,23,25,23,21,23,21,21,29,23,25,23,27,29,23,31,
%U 33,25,29,27,25,25,27,29,35,31,31,27,29,33,31,29,29,29,29,37,31,41,35
%N Least positive integer x such that prime A038873(n) = x^2 - 2y^2 for some y.
%C A prime p is representable in the form x^2 - 2y^2 iff p is 2 or p == 1 or 7 (mod 8). - Pab Ter (pabrlos2(AT)yahoo.com), Oct 22 2005
%C From _Wolfdieter Lang_, Feb 17 2015: (Start)
%C For the corresponding y terms see A002335.
%C a(n), together with A002335(n), gives the fundamental positive solution of the first class of this (generalized) Pell equation. The prime 2 has only one class of proper solutions. The fundamental positive solutions of the second class for the primes from A001132 are given in A254930 and A254931. (End)
%D A. J. C. Cunningham, Quadratic Partitions. Hodgson, London, 1904, p. 1.
%D D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 55.
%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Robert Israel, <a href="/A002334/b002334.txt">Table of n, a(n) for n = 1..10000</a>
%H A. J. C. Cunningham, <a href="/A002330/a002330.pdf">Quadratic Partitions</a>, Hodgson, London, 1904 [Annotated scans of selected pages]
%F a(n)^2 - 2*A002335(n)^2 = A038873(n), n >= 1, and a(n) is the least positive integer satisfying this Pell type equation. - _Wolfdieter Lang_, Feb 12 2015
%e The first solutions [x(n), y(n)] are (the prime is given as first entry): [2,[2,1]], [7,[3,1]], [17,[5,2]], [23,[5,1]], [31,[7,3]], [41,[7,2]], [47,[7,1]], [71,[11,5]], [73,[9,2]], [79,[9,1]], [89,[11,4]], [97,[13,6]], [103,[11,3]], [113,[11,2]], [127,[15,7]], [137,[13,4]], [151,[13,3]], [167,[13,1]], [191,[17,7]], [193,[15,4]], [199,[19,9]], [223,[15,1]], [233,[19,8]], [239,[17,5]], [241,[21,10]], [257,[17,4]], [263,[19,7]], [271,[17,3]], ... - _Wolfdieter Lang_, Feb 17 2015
%p with(numtheory): readlib(issqr): for i from 1 to 250 do p:=ithprime(i): pmod8:=modp(p,8): if p=2 or pmod8=1 or pmod8=7 then for y from 1 do x2:=p+2*y^2: if issqr(x2) then printf("%d,",sqrt(x2)): break fi od fi od: # Pab Ter, May 08 2004
%t maxPrimePi = 200;
%t Reap[Do[If[MatchQ[Mod[p, 8], 1|2|7], rp = Reduce[x > 0 && y > 0 && p == x^2 - 2*y^2, {x, y}, Integers]; If[rp =!= False, xy = {x, y} /. {ToRules[rp /. C[1] -> 1]}; x0 = xy[[All, 1]] // Min // Simplify; Print[{p, xy[[1]]} ]; Sow[x0]]], {p, Prime[Range[maxPrimePi]]}]][[2, 1]] (* _Jean-François Alcover_, Oct 27 2019 *)
%Y Cf. A002335, A035251.
%K nonn,easy
%O 1,1
%A _N. J. A. Sloane_
%E More terms from Pab Ter (pabrlos(AT)yahoo.com), May 08 2004
%E The name has been changed in order to be more precise and to conform with A002335. The offset has been changed to 1. - _Wolfdieter Lang_, Feb 12 2015