login
A261849
Number of squares in an n X n grid that are enclosed in a circle of diameter n (having the same center as the grid).
3
0, 0, 1, 4, 9, 16, 21, 32, 45, 60, 69, 88, 101, 120, 145, 164, 185, 216, 241, 276, 293, 332, 365, 392, 437, 476, 509, 556, 593, 648, 681, 732, 785, 832, 885, 936, 989, 1052, 1109, 1176, 1225, 1288, 1353, 1428, 1489, 1560, 1625, 1696, 1781, 1860, 1933, 2016, 2085, 2180, 2241, 2340, 2425, 2512, 2609, 2700, 2793, 2876, 2973, 3080, 3173
OFFSET
1,4
COMMENTS
a(1)=0 by definition.
The idea behind the sequence was originally proposed at http://www.sanaristikot.net on Aug 19 2015 by Jaska Himberg.
LINKS
V. J. Pohjola ("Olavi Kivalo") and Jaakko Himberg ("Jaska"), 8545.Lukujono16
MATHEMATICA
c[n_, i_, j_] := Ceiling[Sqrt[(n - 2 i)^2 + (n - 2 j)^2]];
t1[q_] := Take[q, 1]; t2[p_] := Take[p, -1]; p2[r_] := Power[r, 2];
area = {}; (Do[
a = {}; (Do[
If[c[n, i, j] == n || c[n, i, j] == n - 1 || c[n, i, j] == n - 2,
AppendTo[a, {i, j}]], {i, 1, Ceiling[n/2 (1 - Sqrt[2]/2)]}, {j, i,
Floor[n/2]}]);
b = (n - 2*Map[t2, Flatten[Map[t1, GatherBy[a, First]], 1]]);
sum1 = 4*Apply[Plus, Drop[b, -1]]; sum2 = Map[p2, Last[b]];
AppendTo[area, (sum1 + sum2)], {n, 2, 100}]);
Flatten[{0, area}]
a[1] = 0; a[n_] := If[EvenQ[n], 4 Sum[ Floor[ Sqrt[(n/2)^2 - k^2]], {k, n/2}], 4 Floor[n/2] - 3 + 4 Sum[Floor[-1/2 + Sqrt[(n/2)^2 - (k + 1/2)^2]], {k, n/2 - 1}]]; Array[a, 60] (* Giovanni Resta, Sep 10 2015 *)
CROSSREFS
Sequence in context: A140868 A360927 A313343 * A246336 A232656 A364699
KEYWORD
nonn,easy
AUTHOR
V.J. Pohjola, Sep 03 2015
STATUS
approved