A280026 Fill an infinite square array by following a spiral around the origin; in the n-th cell, enter the number of earlier cells that can be seen from that cell.
0, 1, 2, 3, 3, 4, 4, 5, 6, 5, 6, 7, 6, 7, 8, 9, 7, 8, 9, 10, 8, 9, 10, 11, 12, 9, 10, 11, 12, 13, 10, 11, 12, 13, 14, 15, 11, 12, 13, 14, 15, 16, 12, 13, 14, 15, 16, 17, 18, 13, 14, 15, 16, 17, 18, 19, 14, 15, 16, 17, 18, 19, 20, 21, 15, 16, 17, 18, 19, 20, 21
Offset: 0
Examples
The central portion of the spiral is: . 7---9---8---7---6 | | 8 3---3---2 7 | | | | 9 4 0---1 6 | | | 10 4---5---6---5 | 8---9--10--11--12 ...
Links
- Lars Blomberg, Table of n, a(n) for n = 0..10000
Crossrefs
Programs
-
Mathematica
a[n_] := a[n - 1] + If[ IntegerQ@ Sqrt@ n || IntegerQ@ Sqrt[4n +1], 2 - Select[{Sqrt@ n, (Sqrt[4n +1] -1)/2}, IntegerQ][[1]], 1]; a[0] = 0; Array[a, 76, 0] (* Robert G. Wilson v, Dec 25 2016 *)
Formula
Empirically: a(0)=0, a(n+1)=a(n)+d for n>0, when n=k^2 or n=k*(k+1) then d=2-k, else d=1.
Extensions
Corrected a(23) and more terms from Lars Blomberg, Dec 25 2016
Comments