A123663 Number of shared edges in a spiral of n unit squares.
0, 1, 2, 4, 5, 7, 8, 10, 12, 13, 15, 17, 18, 20, 22, 24, 25, 27, 29, 31, 32, 34, 36, 38, 40, 41, 43, 45, 47, 49, 50, 52, 54, 56, 58, 60, 61, 63, 65, 67, 69, 71, 72, 74, 76, 78, 80, 82, 84, 85, 87, 89, 91, 93, 95, 97, 98, 100, 102, 104, 106, 108, 110, 112, 113, 115, 117, 119
Offset: 1
References
- F. Harary and H. Harborth, Extremal Animals, Journal of Combinatorics, Information & System Sciences, Vol. 1, No 1, 1-8 (1976).
Links
- Peter Kagey, Table of n, a(n) for n = 1..10000
- Richard A. Brualdi and Geir Dahl, Frobenius-König theorem for classes of (0,+/-1)-matrices, Disc. Math. (2024) Vol. 347, Issue 6, 113951.
- Hung Phuc Hoang and Torsten Mütze, Combinatorial generation via permutation languages. II. Lattice congruences, arXiv:1911.12078 [math.CO], 2019.
Crossrefs
Cf. A002620.
Programs
-
Maple
A[1]:= 0: for n from 2 to 100 do if issqr(2*A[n-1]+1) or issqr(2*A[n-1]+2) then A[n]:= A[n-1]+1 else A[n]:= A[n-1]+2 fi od: seq(A[n],n=1..100); # Robert Israel, Oct 21 2014
-
Mathematica
FoldList[Plus, 0, t = Table[2, {72}]; t[[ Table[ Ceiling[n/2] Floor[n/2], {n, 2, 16}] ]]--; t] (* Robert G. Wilson v, Jan 19 2007 *)
-
PARI
a(n)=2*n - sqrtint(4*n-1) - 1 \\ Charles R Greathouse IV, Nov 29 2016
-
Python
from math import isqrt def A123663(n): return (m:=n<<1)-1-isqrt((m<<1)-1) # Chai Wah Wu, Jul 28 2022
-
Ruby
a123663 = [0]; k = 0; a_n = 0; (1..N).to_a.each{ |i| 2.times{ k.times{ a_n += 2; a123663 << a_n }; a_n += 1; a123663 << a_n; }; k += 1}
Formula
a(n) = 2n - ceiling(2*sqrt(n)). - Julian F. Fleron, Nov 29 2016
a(n) = a(n-1) + 2 - [n-1 is a square or a pronic number], where [] stands for the Iverson bracket. - Luc Rousseau, Dec 28 2019
Extensions
Extended by Robert G. Wilson v, Jan 19 2007
Comments