login
Positive numbers of the form x^2 - 2y^2 with integers x, y.
14

%I #105 Jan 03 2024 01:34:34

%S 1,2,4,7,8,9,14,16,17,18,23,25,28,31,32,34,36,41,46,47,49,50,56,62,63,

%T 64,68,71,72,73,79,81,82,89,92,94,97,98,100,103,112,113,119,121,124,

%U 126,127,128,136,137,142,144,146,151,153,158,161,162,164,167,169,175,178

%N Positive numbers of the form x^2 - 2y^2 with integers x, y.

%C x^2 - 2y^2 has discriminant 8. - _N. J. A. Sloane_, May 30 2014

%C A positive number n is representable in the form x^2 - 2y^2 iff every prime p == 3 or 5 (mod 8) dividing n occurs to an even power.

%C Indices of nonzero terms in expansion of Dirichlet series Product_p (1-(Kronecker(m,p)+1)*p^(-s)+Kronecker(m,p)*p^(-2s))^(-1) for m=2 (A035185). [amended by _Georg Fischer_, Sep 03 2020]

%C Also positive numbers of the form 2x^2 - y^2. If x^2 - 2y^2 = n, 2(x+y)^2 - (x+2y)^2 = n. - _Franklin T. Adams-Watters_, Nov 09 2009

%C Except 2, prime numbers in this sequence have the form p=8k+-1. According to the first comment, prime factors of the forms (8k+-3),(8k+-5) occur in x^2 - 2y^2 in even powers. If x^2 - 2y^2 is a prime number, those powers must be 0. Only factors 8k+-1 remain. Example: 137=8*17+1. - _Jerzy R Borysowicz_, Nov 04 2015

%C The product of any two terms of the sequence is a term too. A proof follows from the identity: (a^2-2b^2)(c^2-2d^2) = (2bd+ac)^2 - 2(ad+bc)^2. Example: 127*175 has form x^2-2y^2, with x=9335, y=6600. - _Jerzy R Borysowicz_, Nov 28 2015

%C Primitive terms (not a product of earlier terms that are greater than 1 in the sequence) are A055673 except 1. - _Charles R Greathouse IV_, Sep 10 2016

%C Positive numbers of the form u^2 + 2uv - v^2. - _Thomas Ordowski_, Feb 17 2017

%C For integer numbers z, a, k and z^2+a^2>0, k>=0: z^(4k) + a^4 is in A035251 because z^(4k) + a^4 = (z^(2k) + a^2)^2 - 2(a*z^k)^2. Assume 0^0 = 1. Examples: 3^4 + 1^4 = 82, 3^8+4^4=6817. - _Jerzy R Borysowicz_, Mar 09 2017

%C Numbers that are the difference between two legs of a Pythagorean right triangle. - _Michael Somos_, Apr 02 2017

%H T. D. Noe, <a href="/A035251/b035251.txt">Table of n, a(n) for n = 1..1000</a>

%H K. Matthews, <a href="http://dx.doi.org/10.1090/S0025-5718-01-01381-3">Thue's theorem and the diophantine equation x^2-D*y^2=+-N</a>, Math. Comp. 71 (239) (2002) 1281-1286.

%H K. Matthews, <a href="http://www.numbertheory.org/php/patz.html">Solving the diophantine equation x^2-D*y^2=N, D>0</a>, (2016).

%H Sci.math, <a href="http://www.math.niu.edu/~rusin/known-math/98/pells">General Pell equation: x^2 - N*y^2 = D</a>, 1998

%H Sci.math, <a href="/A035251/a035251.txt">General Pell equation: x^2 - N*y^2 = D</a>, 1998 [Edited and cached copy]

%H N. J. A. Sloane et al., <a href="https://oeis.org/wiki/Binary_Quadratic_Forms_and_OEIS">Binary Quadratic Forms and OEIS</a> (Index to related sequences, programs, references)

%e The (x,y) pairs, with minimum x, that solve the equation are (1,0), (2,1), (2,0), (3,1), (4,2), (3,0), (4,1), (4,0), (5,2), (6,3), (5,1), (5,0), (6,2), (7,3), (8,4), (6,1), (6,0), (7,2), (8,3), (7,1), (7,0), (10,5), (8,2), ... If the positive number is a perfect square, y=0 yields a trivial solution. - _R. J. Mathar_, Sep 10 2016

%p filter:= proc(n) local F;

%p F:= select(t -> t[1] mod 8 = 3 or t[1] mod 8 = 5, ifactors(n)[2]);

%p map(t -> t[2],F)::list(even);

%p end proc:

%p select(filter, [$1..1000]); # _Robert Israel_, Dec 01 2015

%t Reap[For[n = 1, n < 200, n++, r = Reduce[x^2 - 2 y^2 == n, {x, y}, Integers]; If[r =!= False, Sow[n]]]][[2, 1]] (* _Jean-François Alcover_, Oct 31 2016 *)

%o (PARI) select(x -> x, direuler(p=2,201,1/(1-(kronecker(2,p)*(X-X^2))-X)), 1) \\ Fixed by _Andrey Zabolotskiy_, Jul 30 2020

%o (PARI) {a(n) = my(m, c); if( n<1, 0, c=0; m=0; while( c<n, m++; if( sum(i=0, sqrtint(m\2), issquare(m+2*i^2)), c++)); m)}; /* _Michael Somos_, Aug 17 2006 */

%o (PARI) is(n)=#bnfisintnorm(bnfinit(z^2-2),n) \\ _Ralf Stephan_, Oct 14 2013

%o (Python)

%o from itertools import count, islice

%o from sympy import factorint

%o def A035251_gen(): # generator of terms

%o return filter(lambda n:all(not((2 < p & 7 < 7) and e & 1) for p, e in factorint(n).items()),count(1))

%o A035251_list = list(islice(A035251_gen(),30)) # _Chai Wah Wu_, Jun 28 2022

%Y Cf. A035185, A042965, A001481, A000047.

%Y Primes: A038873.

%Y Complement of A232531. - _Thomas Ordowski_ and _Altug Alkan_, Feb 09 2017

%K nonn

%O 1,2

%A _N. J. A. Sloane_

%E Better description from Sharon Sela (sharonsela(AT)hotmail.com), Mar 10 2002