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!)
A063725 Number of ordered pairs (x,y) of positive integers such that x^2 + y^2 = n. 33

%I #34 May 17 2023 10:24:43

%S 0,0,1,0,0,2,0,0,1,0,2,0,0,2,0,0,0,2,1,0,2,0,0,0,0,2,2,0,0,2,0,0,1,0,

%T 2,0,0,2,0,0,2,2,0,0,0,2,0,0,0,0,3,0,2,2,0,0,0,0,2,0,0,2,0,0,0,4,0,0,

%U 2,0,0,0,1,2,2,0,0,0,0,0,2,0,2,0,0,4,0,0,0,2,2,0,0

%N Number of ordered pairs (x,y) of positive integers such that x^2 + y^2 = n.

%C a(A018825(n))=0; a(A000404(n))>0; a(A081324(n))=1; a(A004431(n))>1. - _Reinhard Zumkeller_, Aug 16 2011

%H T. D. Noe, <a href="/A063725/b063725.txt">Table of n, a(n) for n = 0..10000</a>

%H <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>

%F G.f.: (Sum_{m=1..inf} x^(m^2))^2.

%F a(n) = ( A004018(n) - 2*A000122(n) + A000007(n) )/4. - _Max Alekseyev_, Sep 29 2012

%F G.f.: (theta_3(q) - 1)^2/4, where theta_3() is the Jacobi theta function. - _Ilya Gutkovskiy_, Aug 08 2018

%e a(5) = 2 from the solutions (1,2) and (2,1).

%t nn = 100; t = Table[0, {nn}]; s = Sqrt[nn]; Do[n = x^2 + y^2; If[n <= nn, t[[n]]++], {x, s}, {y, s}]; Join[{0}, t] (* _T. D. Noe_, Apr 03 2011 *)

%o (Haskell)

%o a063725 n =

%o sum $ map (a010052 . (n -)) $ takeWhile (< n) $ tail a000290_list

%o a063725_list = map a063725 [0..]

%o -- _Reinhard Zumkeller_, Aug 16 2011

%o (PARI) a(n)=if(n==0, return(0)); my(f=factor(n)); prod(i=1, #f~, if(f[i, 1]%4==1, f[i, 2]+1, f[i, 2]%2==0 || f[i, 1]==2)) - issquare(n) \\ _Charles R Greathouse IV_, May 18 2016

%o (Python)

%o from math import prod

%o from sympy import factorint

%o def A063725(n):

%o f = factorint(n)

%o return prod(1 if p==2 else (e+1 if p&3==1 else (e+1)&1) for p, e in f.items())-(not any(e&1 for e in f.values())) if n else 0 # _Chai Wah Wu_, May 17 2023

%Y Cf. A000404 (the numbers n that can be represented in this form).

%Y Cf. A000161, A063691, A063730, A025426, A000290, A010052.

%Y Column k=2 of A337165.

%K nonn

%O 0,6

%A _N. J. A. Sloane_, Aug 23 2001

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 April 17 21:22 EDT 2024. Contains 371767 sequences. (Running on oeis4.)