login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A263715 Nonnegative integers that are the sum or difference of two squares. 5

%I #21 Jun 28 2022 15:28:51

%S 0,1,2,3,4,5,7,8,9,10,11,12,13,15,16,17,18,19,20,21,23,24,25,26,27,28,

%T 29,31,32,33,34,35,36,37,39,40,41,43,44,45,47,48,49,50,51,52,53,55,56,

%U 57,58,59,60,61,63,64,65,67,68,69,71,72,73,74,75,76,77,79,80

%N Nonnegative integers that are the sum or difference of two squares.

%C Contains all integers that are not equal to 2 (mod 4) (they are of the form y^2 - x^2) and those of the form 4k+2 = 2*(2k+1) with the odd number 2k+1 equal to the sum of two squares (A057653).

%H Jean-Christophe Hervé, <a href="/A263715/b263715.txt">Table of n, a(n) for n = 1..10000</a>

%F Union of A001481 (sums of two squares) and A042965 (differences of two squares).

%F Union of A042965 and 2*A057653 = A097269, with intersection of A042965 and A097269 = {}.

%F Union of A020668 (x^2+y^2 and a^2-b^2), A097269 (x^2+y^2, not a^2-b^2) and A263737 (not x^2+y^2, a^2-b^2).

%e 2 = 1^2 + 1^2, 3 = 2^2 - 1^2, 4 = 2^2 + 0^2, 5 = 2^2 + 1^2 = 3^2 - 2^2.

%t r[n_] := Reduce[n == x^2 + y^2, {x, y}, Integers] || Reduce[0 <= y <= x && n == x^2 - y^2, {x, y}, Integers]; Reap[Do[If[r[n] =!= False, Sow[n]], {n, 0, 80}]][[2, 1]] (* _Jean-François Alcover_, Oct 25 2015 *)

%o (Python)

%o from itertools import count, islice

%o from sympy import factorint

%o def A263715_gen(): # generator of terms

%o return filter(lambda n: n & 3 != 2 or all(p & 3 != 3 or e & 1 == 0 for p, e in factorint(n).items()),count(0))

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

%Y Cf. A001481, A057653, A097269, A042965, A020668, A263737.

%Y Cf. A062316 (complement), A079298.

%K nonn

%O 1,3

%A _Jean-Christophe Hervé_, Oct 24 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 29 06:44 EDT 2024. Contains 371265 sequences. (Running on oeis4.)