login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A229062
1 if n is representable as sum of two nonnegative squares, otherwise 0.
8
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, 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, 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
OFFSET
0,1
COMMENTS
Characteristic function of A001481.
a(n) = 1 if A000161(n) > 0.
a(A022544(n)) = 0.
Multiplicative because A002654 is. - Andrew Howroyd, Aug 01 2018
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
FORMULA
a(n) = min{1, A004018(n)}. - N. J. A. Sloane, Jan 11 2020
MATHEMATICA
Join[{1}, Table[If[SquaresR[2, n]>1, 1, 0], {n, 120}]] (* Harvey P. Dale, Aug 25 2017 *)
PROG
(PARI) a(n)=my(f=0); my(r=sqrtint(n)); forstep(i=r, 1, -1, if(issquare(n-i*i), f=1; break)); f
(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
(Python)
from sympy import factorint
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
CROSSREFS
Cf. A002654, A004018, A070176. Partial sums are in A102548.
Sequence in context: A011748 A145361 A189222 * A130304 A267533 A118274
KEYWORD
nonn,mult
AUTHOR
Ralf Stephan, Sep 17 2013
STATUS
approved