%I #45 Sep 24 2023 09:15:24
%S 2,7,14,23,31,34,46,47,62,71,79,94,98,103,119,127,142,151,158,167,191,
%T 194,199,206,223,238,239,254,263,271,287,302,311,322,334,343,359,367,
%U 382,383,386,391,398,431,439,446,463,478,479,482,487,503,511
%N Positive integers D such that the generalized Pell equation X^2 - D Y^2 = 2 is soluble.
%C For the fundamental positive solution x(n)^2 - a(n)*y(n)^2 = 2 see (x(n) = A261247(n), y(n) = A261248(n)), for n >= 1.
%C Conjecture: The sequence consists of all numbers D not a square and even D = 2*d has odd d with prime factors of the form 1 or 7 (mod 8). Odd D has prime factors of the form 1 or 7 (mod 8) but there is an odd number of primes of the form 7 (mod 8). The following will prove that these conditions for D are necessary in order to have solutions.
%C This conjecture is false. For the odd D case see the counterexamples in A263010, and for the even D in A264352. - _Wolfdieter Lang_, Nov 12 2015
%C If there is a solution for D, D not a square, then only one class of solution exists due to Nagell's Theorem 110, p. 208, because then 2 divides 2*D. All solutions will be proper because 2 is a prime.
%C For the even prime D = p = 2 the positive fundamental solution is [x(1) = 2, y(1) = 1].
%C For odd primes D = p there can be solutions only for p == +7 (mod 8), that is p from A007522. Then x and y are both odd. Proof: Consider a solution of x^2 - p*y^2 = 2. The parities of x and y have to be either even and even or odd and odd. For odd x one has x^2 == +1 (mod 8) (because x^2 = 8*T(X) + 1 with x = 2*X+1 and the triangular numbers T = A000217); similarly for y^2 if y is odd. In the even-even case x^2 and y^2 are both congruent to 4 (mod 8). The even-even case leads to 4 - 4*p = 2 (mod 8), excluding all odd p, namely p == 1, 3, 5, 7 (mod 8). The odd-odd case is 1 - p*1 = 2 (mod 8), and p == 1, 3, 5 (mod 8) are excluded. Therefore, only p == 7 (mod 8) qualifies for a solution, and then x and y will be both odd.
%C For D = p == 7 (mod 8) from A007522 one can test if there exists a fundamental positive solution (at most one class can exist, therefore there is either no solution or just one) [2*U(p)+1, 2*V(p)+1] by checking the two inequalities (see Nagell, eq. (4) and (5), p. 206) 0 <= V(p) < floor((Y(p)/sqrt(X(p) + 1) - 1)/2) and 0 <= U(p) <= floor((sqrt(X(p) + 1) - 1)/2), with the positive fundamental solution [X(p), Y(p)] of X^2 - p*Y^2 = +1. These solutions can be found in (A033313(k), A033317(k)) if A000037(k) is the prime p == 7 (mod 8) one is testing.
%C For composite even D there are solutions only if D/2 is odd. Proof: If D is even then x has to be even, hence x^2 == 0 (mod 4) and then D*y^2 == -2 (mod 4), hence D cannot be 0 (mod 4). Thus an even D can only be of the form D = 2*d with d odd. The modulo 3 and modulo 5 argument used in the next case will show that d can have only prime factors of the form +1 or -1 (mod 8).
%C For composite odd D one finds like above that the even-even x and y case is excluded, and the odd-odd case needs D == -1 (mod 8) == 7 (mod 8). Hence a candidate for D is from A004771 - A007522. D cannot have any prime factor p of the form 3 or 5 (mod 8) because otherwise x^2 == 2 (mod p), but the Legendre symbol (2/p) = -1 for such p's (see, e.g., Nagell, Theorem 81, p. 136). For example, D = 15 = 3*5 cannot have a solution. Thus the only candidates for D have prime factors p of the form +1 or +7 (mod 8), with the number of the latter ones being odd. E.g., D = 7*17 = 119 qualifies as a candidate and it has indeed solutions, namely the ones obtainable from the fundamental one [11, 1].
%C The general proper positive solutions for D(n) = a(n) are obtained from the fundamental ones [x(n), y(n)] given in A261247 and A261248 with the help of powers of the matrix M(n) = [[u(n), D(n)*v(n)], [v(n), u(n)]], where u(n) and v(n) are the positive fundamental solutions of U(n) - D(n)*V(n) = 1, by (x(n; k), y(n; k))^T = M(n)^k (x(n), y(n))^T (T for transposed), for k >= 0. [u(n), v(n)] = [A033313(j(n)), A033317(j(n))] if A000037(j(n)) = D(n) = a(n).
%C Observation: All degrees (7, 47, 79, 103, 119, 127) of the modular equations derived for solving Ramanujan's question 699 by Galkin & Kozirev (see reference and A318732) are terms of this sequence. - _Hugo Pfoertner_, Sep 24 2023
%D J. W. S. Cassels, Rational Quadratic Forms, Cambridge, 1978; see Chap. 3.
%D V. M. Galkin, O. R. Kozyrev, On an algebraic problem of Ramanujan, pp. 89-94 in Number Theoretic And Algebraic Methods In Computer Science - Proceedings Of The International Conference, Moscow 1993, Ed. Horst G. Zimmer, World Scientific, 31 Aug 1995
%D T. Nagell, Introduction to Number Theory, Chelsea Publishing Company, New York, 1964.
%H Giovanni Resta, <a href="/A261246/b261246.txt">Table of n, a(n) for n = 1..1000</a>
%H Wolfdieter Lang, <a href="http://www.itp.kit.edu/~wl/BinQuadForm.html">Binary Quadratic Forms (indefinite case).</a>
%e The first fundamental solutions [x(n), y(n)] are (the first entry gives D(n)=a(n)):
%e [2, [2, 1]], [7, [3, 1]], [14, [4, 1]],
%e [23, [5, 1]], [31, [39, 7]], [34, [6, 1]],
%e [46, [156, 23]], [47, [7, 1]], [62, [8, 1]],
%e [71, [59, 7]], [79, [9, 1]], [94, [1464, 151]],
%e [98, [10, 1]], [103, [477, 47]], [119, [11, 1]],
%e [127, [2175, 193]], [142, [12, 1]],
%e [151, [41571, 3383]], [158, [88, 7]],
%e [167, [13, 1]], [191, [2999, 217]],
%e [194, [14, 1]], [199, [127539, 9041]],
%e [206, [244, 17]], [223, [15, 1]], [238, [108, 7]],
%e [239, [2489, 161]], ...
%t Select[Range[600], False =!= Reduce[x^2 - # y^2 == 2, {x, y}, Integers] &] (* _Giovanni Resta_, Aug 12 2017 *)
%Y Cf. A261247, A261248, A007522, A004771, A000217, A000037, A033313, A033317, A263010.
%Y See also A038873 (2 and primes == +-1 mod 8), A001132.
%K nonn
%O 1,1
%A _Wolfdieter Lang_, Sep 06 2015