Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #27 Oct 16 2023 07:41:44
%S 1,4,12,8,12,20,12,20,16,20,28,20,28,20,28,36,28,36,32,36,28,36,28,44,
%T 36,44,36,44,40,44,36,44,52,44,52,44,52,44,52,44,52,60,48,60,52,60,52,
%U 60,52,60,52,60,68,52,68,60,68,64,68,60,68,60,68,60,68,76,68,76,60,76,68,76,68
%N Number of intersections of a grid and (growing) circle with center at a lattice point.
%C Counted intersections are intersections of the circumference of a circle and the grid (all the grid lines together). Beginning with the smallest circle, the radius is increasing, and a new term is added only when the number of intersections changes.
%C a(n) is a multiple of 4 for all n except 1.
%e a(1)=1 because at the beginning it's just a point. If we start increasing the circle, there would be 4 intersections, so a(2)=4, this holds while the radius is between 0 and 1 (assuming the cells of the grid have side length 1). If the radius is between 1 and sqrt(2), there are 12 intersections, so a(3)=12. After that: r=sqrt(2), a(4)=8; sqrt(2) < r < 2, a(5)=12.
%e The number of intersections changes when the squared radius reaches a sum of two nonzero squares (A000404) and when it starts exceeding a sum of two squares, so in the latter case there are three consecutive terms of the sequence corresponding to the squared radius smaller than a term of A001481, equal to it, and exceeding it, like a(3)-a(5) in the example above.
%t issq[n_] := n == Floor[Sqrt[n]]^2;
%t ss[1] = 0; ss[n_] := Product[If[Mod[First@pe, 4] == 1, Last@pe + 1, Boole[EvenQ[Last@pe] || First@pe == 2]], {pe, FactorInteger[n]}] - Boole[issq[n]]; (* A063725, after _Charles R Greathouse IV_ *)
%t t = 4; a = {1};
%t Do[AppendTo[a, t - 4 ss[n]]; If[issq[n], t += 8]; AppendTo[a, t], {n, 40}];
%t First /@ Split[a] (* _Andrey Zabolotskiy_, Sep 20 2023 *)
%Y Cf. A000404, A001481, A063725.
%Y A242118 (without 0) and A017113 are subsequences.
%K nonn
%O 1,2
%A _Volodymyr Dykun_, Mar 03 2023
%E a(16) and beyond from _Andrey Zabolotskiy_, Sep 20 2023