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!)
A229062 1 if n is representable as sum of two nonnegative squares, otherwise 0. 8

%I #47 Jan 26 2024 14:28:10

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

%T 1,0,1,1,0,0,1,1,0,0,0,1,0,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,0,0,1,1,0,0,

%U 1,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1

%N 1 if n is representable as sum of two nonnegative squares, otherwise 0.

%C Characteristic function of A001481.

%C a(n) = 1 if A000161(n) > 0.

%C a(A022544(n)) = 0.

%C Multiplicative because A002654 is. - _Andrew Howroyd_, Aug 01 2018

%C For positive n, m = 2*a(n) + 1 is the smallest positive integer such that m * n is not a sum of two squares. - _Peter Schorn_, Dec 29 2023

%H Antti Karttunen, <a href="/A229062/b229062.txt">Table of n, a(n) for n = 0..65537</a>

%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>

%F a(n) = min{1, A004018(n)}. - _N. J. A. Sloane_, Jan 11 2020

%t Join[{1},Table[If[SquaresR[2,n]>1,1,0],{n,120}]] (* _Harvey P. Dale_, Aug 25 2017 *)

%o (PARI) a(n)=my(f=0); my(r=sqrtint(n)); forstep(i=r, 1, -1, if(issquare(n-i*i), f=1; break)); f

%o (PARI) a(n)=if(0==n,1,(sumdiv(n, d,(d%4==1) - (d%4==3)) > 0)); \\ _Andrew Howroyd_, Aug 01 2018, the check for 0-argument added by _Antti Karttunen_, Apr 22 2022

%o (Python)

%o from sympy import factorint

%o def A229062(n): return int(all(p & 3 != 3 or e & 1 == 0 for p, e in factorint(n).items())) # _Chai Wah Wu_, Jun 28 2022

%Y Cf. A002654, A004018, A070176. Partial sums are in A102548.

%Y Cf. A000161, A022544.

%K nonn,mult

%O 0,1

%A _Ralf Stephan_, Sep 17 2013

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 19 19:02 EDT 2024. Contains 371798 sequences. (Running on oeis4.)