%I #62 Feb 07 2018 16:33:58
%S 1,4,11,22,40,64,98,140,195,260,341,434,546,672,820,984,1173,1380,
%T 1615,1870,2156,2464,2806,3172,3575,4004,4473,4970,5510,6080,6696,
%U 7344,8041,8772,9555,10374,11248,12160,13130,14140,15211,16324,17501,18722,20010
%N Take the list t(n,0) = {1,...,n}; denote by t(n,j) this list after rotating to left (or right) by j positions. Calculate inner product of t(n,0) and t(n,j) and denote the value by s(n,j). Compute this inner product for all j = 1..n and choose the smallest. This is a(n).
%C If the largest were chosen rather than the smallest, then A000330(n), the square pyramidal numbers, would be obtained. Also, if the inner product of t with 1-rotated-t is calculated, then A006527(n) is produced.
%C From _Jonathan Halabi_, Dec 25 2017, on behalf of Maya Nicklas: (Start)
%C a(n) is the number of squares (of any size) that occur in a skewed n X n chessboard, having n rows of n squares, each offset by one square from the row above. For instance, a(4) is the number of squares in this diagram:
%C XXXX
%C .XXXX
%C ..XXXX
%C ...XXXX
%C which is 22.
%C (End)
%C It seems that if we connect the top row of this skewed board with its bottom row (in the same skewed way), i.e., make the board toroidal, and count squares, we will get A128624. - _Andrey Zabolotskiy_, Dec 25 2017
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (2,1,-4,1,2,-1).
%F a(n) = Min{y; y=t(n, 0)*t(n, x)=s(n, x); for x=1..n}.
%F a(n) = n*(2*n*(5*n+12)-3*(-1)^n+11)/48.
%F G.f.: x*(1+2*x+2*x^2)/((1+x)^2*(1-x)^4). - _Bruno Berselli_, Dec 01 2010
%F For n >= 1, a(n) = A000330(n) - A034828(n). - _Luce ETIENNE_, Aug 11 2014
%F a(n) = Sum_{i=0..floor(n/2)} (n-i)*(n-2*i). For n=7, a(7) = 7*7 + 6*5 + 5*3 + 4*1 = 98. - _Bruno Berselli_, Oct 26 2015
%e For n=6: t(6,0) = {1,2,3,4,5,6}, t(6,3) = {4,5,6,1,2,3};
%e compute scalar products for all rotations:
%e {76,67,64,67,76,91} of which the smallest is 64, so a(6)=64.
%t t0[x_] := Table[w, {w, 1, x}]; jr[x_, j_] := RotateRight[t0[x], j]; Table[Min[Table[Apply[Plus, t0[g]*jr[g, i]], {i, 1, g}]], {g, 1, up}]
%Y Cf. A000330, A006527, A094414.
%K nonn,easy
%O 1,2
%A _Labos Elemer_, Oct 14 2003
%E Edited by _Bruno Berselli_, Dec 01 2010