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.
%I A242118 #48 Sep 13 2024 13:25:04 %S A242118 0,4,12,20,28,28,44,52,60,68,68,84,92,92,108,108,124,124,140,148,148, %T A242118 164,172,180,188,180,196,212,220,220,228,244,252,260,260,268,284,284, %U A242118 300,300,308,316,332,340,348,348,364,372,380,388,380 %N A242118 Number of unit squares that intersect the circumference of a circle of radius n centered at (0,0). %C A242118 For the points that form the Pythagorean triple (for example see illustration n = 5, on the first quadrant at coordinate (4,3) and (3,4)), the transit of circumference occurs exactly at the corners, therefore there are no additional intersecting squares on the upper or lower rows (diagonally NE & SW directions) of such points. %C A242118 If the center of the circle is instead chosen at the middle of a square grid centered at (1/2,0), the sequence will be 2*A004767(n-1). %H A242118 Kival Ngaokrajang, <a href="/A242118/a242118_1.pdf">Illustration of initial terms</a> %F A242118 a(n) = 4*Sum{k=1..n} ceiling(sqrt(n^2 - (k-1)^2)) - floor(sqrt(n^2 - k^2)). - _Orson R. L. Peters_, Jan 30 2017 %F A242118 a(n) = 8*n - A046109(n) for n > 0. - conjectured by _Orson R. L. Peters_, Jan 30 2017, proved by _Andrey Zabolotskiy_, Jan 31 2017 %o A242118 (Python) %o A242118 a = lambda n: sum(4 for x in range(n) for y in range(n) %o A242118 if x**2 + y**2 < n**2 and (x+1)**2 + (y+1)**2 > n**2) %o A242118 (Python) %o A242118 from sympy import factorint %o A242118 def a(n): %o A242118 r = 1 %o A242118 for p, e in factorint(n).items(): %o A242118 if p%4 == 1: r *= 2*e + 1 %o A242118 return 8*n - 4*r if n > 0 else 0 %Y A242118 Cf. A009003, A004767. %K A242118 nonn %O A242118 0,2 %A A242118 _Kival Ngaokrajang_, May 05 2014 %E A242118 Terms corrected by _Orson R. L. Peters_, Jan 30 2017