cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A073092 Number of numbers of the form x^2 + y^2 (0 <= x <= y) less than or equal to n.

This page as a plain text file.
%I A073092 #20 Sep 09 2022 02:37:18
%S A073092 1,2,3,3,4,5,5,5,6,7,8,8,8,9,9,9,10,11,12,12,13,13,13,13,13,15,16,16,
%T A073092 16,17,17,17,18,18,19,19,20,21,21,21,22,23,23,23,23,24,24,24,24,25,27,
%U A073092 27,28,29,29,29,29,29,30,30,30,31,31,31,32,34,34,34,35,35,35,35,36,37,38
%N A073092 Number of numbers of the form x^2 + y^2 (0 <= x <= y) less than or equal to n.
%H A073092 Amiram Eldar, <a href="/A073092/b073092.txt">Table of n, a(n) for n = 0..10000</a>
%F A073092 a(n) = Sum_{k=0..n} A000161(k).
%F A073092 a(n) is asymptotic to Pi*n/8.
%e A073092 0^2 + 0^2, 0^2 + 1^2, 1^2 + 1^2 are less than or equal to 2 hence a(2) = 3.
%t A073092 Accumulate @ Table[Length @ PowersRepresentations[n, 2, 2], {n, 0, 100}] (* _Amiram Eldar_, Mar 08 2020 *)
%o A073092 (PARI) a(n)=sum(x=0,n,sum(y=0,x,if((sign(x^2+y^2-n)+1)*sign(x^2+y^2-n),0,1)))
%o A073092 (Python)
%o A073092 from itertools import count, islice
%o A073092 from math import prod
%o A073092 from sympy import factorint
%o A073092 def A073092_gen(): # generator of terms
%o A073092     yield (c:=1)
%o A073092     for n in count(1):
%o A073092         f = factorint(n)
%o A073092         c += int(not any(e&1 for e in f.values())) + (((m:=prod(1 if p==2 else (e+1 if p&3==1 else (e+1)&1) for p, e in f.items()))+((((~n & n-1).bit_length()&1)<<1)-1 if m&1 else 0))>>1)
%o A073092         yield c
%o A073092 A073092_list = list(islice(A073092_gen(),30)) # _Chai Wah Wu_, Sep 08 2022
%Y A073092 Cf. A000161, A001481.
%Y A073092 Cf. A057655.
%K A073092 easy,nonn
%O A073092 0,2
%A A073092 _Benoit Cloitre_, Aug 18 2002