%I
%S 1,3,7,12,17,24,32,41,51,61,73
%N Given a square grid with side n consisting of n^2 cells (or points), a(n) is the maximum number of points that can be painted so that, if any four of the painted ones are chosen, they do not form a square with sides parallel to the grid.
%C a(1) through a(9) were found by an exhaustive computational search for all solutions. This sequence is complementary to A152125: A152125(n) + A227133(n) = n^2.
%C A064194(n) is a lower bound on a(n) (see the comments in A047999).  _N. J. A. Sloane_, Jan 18 2016
%C a(11) >= 71 (by extending the n=10 solution towards the southeast).  _N. J. A. Sloane_, Feb 12 2016
%C a(11) >= 73, a(12) >= 85, a(13) >= 98, a(14) >= 112, a(15) >= 127, a(16) >= 142 (see links). These lower bounds were obtained using tabu search and simulated annealing via the Ascension Optimization Framework.  _Peter Karpov_, Feb 22 2016; corrected Jun 04 2016
%C Note that n is the number of cells along each edge of the grid. The case n=1 corresponds to a single square cell, n=2 to a 2 X 2 array of four square cells. The standard chessboard is the case n=8. It is easy to get confused and to think of the case n=2 as a 3 X 3 grid of dots (the vertices of the squares in the grid). Don't think like that!  _N. J. A. Sloane_, Apr 03 2016
%H Peter Karpov, <a href="http://inversed.ru/InvMem.htm#InvMem_20">InvMem, Item 20</a> [Link added by _N. J. A. Sloane_, Feb 24 2016]
%H Peter Karpov, <a href="http://inversed.ru/Ascension.htm">Ascension Optimization Framework</a> [Link added by _N. J. A. Sloane_, Feb 24 2016]
%H Peter Karpov, <a href="/A227133/a227133_2.png">Best configurations known for n = 11 .. 16</a>
%H Giovanni Resta, <a href="/A227133/a227133.png">Illustration of a(2)a(10)</a>
%H Giovanni Resta, <a href="/A227133/a227133_8.png">Individual illustration for a(8)</a>
%e n=9. A maximum of a(9) = 51 points (X) of 81 can be painted while while 30 (.) must be left unpainted. The following 9 X 9 square is an example:
%e . X X X X X . X .
%e X . X . . X X X X
%e X X . . X . X . X
%e X . . X X X X . .
%e X X X . X . . X X
%e X . X X X . . . X
%e . X X . . X X . X
%e X X . X . X . X X
%e . X X X X X X X .
%e Here there is no subsquare with all vertices = X and having sides parallel to the axes.
%t a[n_] := Block[{m, qq, nv = n^2, ne}, qq = Flatten[1 + Table[n*x + y + {0, s, s*n, s*(n + 1)}, {x, 0, n2}, {y, 0, n2}, {s, Min[nx, ny] 1}], 2]; ne = Length@qq; m = Table[0, {ne}, {nv}]; Do[m[[i, qq[[i]]]] = 1, {i, ne}]; Total@ Quiet@ LinearProgramming[Table[1, {nv}], m, Table[{3, 1}, {ne}], Table[{0, 1}, {nv}], Integers]]; Array[a,8] (* _Giovanni Resta_, Jul 14 2013 *)
%Y Cf. A152125 (the complementary problem), A000330, A240443 (when all squares must be avoided, not just those aligned with the grid).
%Y See also A047999, A064194.
%Y For a lower bound see A269745.
%Y For analogs that avoid triangles in the square grid see A271906, A271907.
%Y For an equilateral triangular grid analog see A227308 (and A227116).
%Y For the threedimensional analog see A268239.
%K nonn,hard,nice,more
%O 1,2
%A _Heinrich Ludwig_, Jul 06 2013
%E a(10) from _Giovanni Resta_, Jul 14 2013
%E a(11) from _Paul Tabatabai_ using integer programming, Sep 25 2018
