No-Three-in-a-Line-Problem

Author

Eric W. Weisstein
April 20, 2005

This notebook downloaded from http://mathworld.wolfram.com/notebooks/PointLattices/No-Three-in-a-Line-Problem.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/No-Three-in-a-Line-Problem.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Code

strings={{"0000000000000000000000000010100000000000000000000000","0000000000000000100000000000000000000001000000000000","0000000000000000000000000000000000000001001000000000","0000000000100000000001000000000000000000000000000000","0000000000000000000000000010000001000000000000000000","0000001000000000000000000000000000010000000000000000","0000000000000000000000100000000000000000000000100000","0000000000010000000000000000000000000000000100000000","0000000100000000000000000000000001000000000000000000","0010000000000000000000000000010000000000000000000000","0000000000000000000000000000000000001000000000001000","0000000000000000000000000000000000000010000010000000","0110000000000000000000000000000000000000000000000000","0000000000010000000100000000000000000000000000000000","0000000000000000000100000000000100000000000000000000","0000000000100000000000000000000000100000000000000000","0000010000000000000000000000000000000000000000000010","0000000000000001000001000000000000000000000000000000","0000100010000000000000000000000000000000000000000000","0000000000000000000000000000000000000110000000000000","0000000000000010000000000000100000000000000000000000","0000000000000000000000000000000000100000000000001000","0000000001000000000000000000000000000000000001000000","1000000000000000000010000000000000000000000000000000","0000000000000000000000001001000000000000000000000000","1000100000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000010001","0000000000000000000000001001000000000000000000000000","0000000000000000000000000000000100000000000000000001","0000001000000000000000000000000000000000001000000000","0001000000000000010000000000000000000000000000000000","0000000000000000000000010000000000000100000000000000","0000000000000110000000000000000000000000000000000000","0000000000000000000000000000000000000000000100010000","0000000000000000000000000000001000001000000000000000","0100000000000000000000000000000000000000000000100000","0000000000000000010000000000000000000000010000000000","0000000000000000000010000000000010000000000000000000","0000000000000000000000000000000010000000100000000000","0000000000000000000000000000000000000000000000000110","0000000100000100000000000000000000000000000000000000","0001000000000001000000000000000000000000000000000000","0000000000000000000000100000000000000000000000000100","0000000000000000001000000000000000000000000010000000","0000000010000000000000000000000000000000100000000000","0000010000000000000000000000010000000000000000000000","0000000000000000100000000000000000000000000001000000","0000000000000000001000000100000000000000000000000000","0000000000000000000000000000001000000000010000000000","0000000001001000000000000000000000000000000000000000","0000000000001000000000000000000000010000000000000000","0000000000000000000000010100000000000000000000000000"},{"00000000000000000000000100000000100000000000000000","00000000000000000000100000000000000010000000000000","00000000000010001000000000000000000000000000000000","00000000001000000000000000000000000000000100000000","00000000000000000000000000010000001000000000000000","00000000000100000000000001000000000000000000000000","00000001000000000000000000000000000001000000000000","00000000000000001000000000000000000000000001000000","00010000000000000000000000001000000000000000000000","00000000000000000000000001000001000000000000000000","00000000000100000000000000000000000000000000001000","00000000000000000000000000000000000000010000100000","00000010000000000000000000000000000000000000000100","01000000000000000000100000000000000000000000000000","00000000000000000100000000000001000000000000000000","00001000000000000000000000000010000000000000000000","00000000000000000000000000000000000000000010000100","10000000000000000000000000000000000100000000000000","00000000010000100000000000000000000000000000000000","00000000000000010000000000010000000000000000000000","00000000000000000000000000000000000010000000000010","00000000100000000000000100000000000000000000000000","00001000000000000001000000000000000000000000000000","00000000000000000000000000001000000000000000000001","00000100010000000000000000000000000000000000000000","00000000000000000000000000000000000000001000100000","10000000000000000000010000000000000000000000000000","00000000000000000000000000000010000000000000010000","00000000000000000000000000100000000000000100000000","01000000000001000000000000000000000000000000000000","00000000000000000000001000000000001000000000000000","00000000000000000000000000000000000100001000000000","00000000000000100000000000000000000000000000000001","00100001000000000000000000000000000000000000000000","00000000000000000001000000000000000000000000010000","00000000000000000010000000000000100000000000000000","00000000000000000000000000000100000000000000000010","00100000000000000000000000000000000000000001000000","00000100001000000000000000000000000000000000000000","00010000000000000000000000000000000000100000000000","00000000000000000010000010000000000000000000000000","00000000000000000000010000000000000000000000001000","00000010000000000000000000000000010000000000000000","00000000000010000000000000000000000000000010000000","00000000000000000000000010000000000000100000000000","00000000000000010000001000000000000000000000000000","00000000100000000000000000000000000000010000000000","00000000000000000000000000000000010001000000000000","00000000000001000000000000000100000000000000000000","00000000000000000100000000100000000000000000000000"},{"000000000000000001000000000000001000000000000000","000000000000000000000000010000000001000000000000","000000000100000000000100000000000000000000000000","000000000000001000000000000000000000000100000000","000000000000000000100000000000000001000000000000","000000000000000000001000000000001000000000000000","000000000000000000000000100000010000000000000000","000000000000010000000000000000000000000100000000","000100010000000000000000000000000000000000000000","000000000000000001000000000000000000000000000100","000000000000000000000000100000000100000000000000","000000000000000000001000000000000010000000000000","010010000000000000000000000000000000000000000000","000000000001000000000000000000000000000010000000","000000000010000000000000000000000000000000001000","100001000000000000000000000000000000000000000000","000000100000000000100000000000000000000000000000","000000000000000000000000000000000000001000000001","000000000000000000000000000000010000000000010000","000000000000000000010000000010000000000000000000","000000000000000000000000000000000000100000100000","000000000000000000000000010000000000000000000100","010000000000000000000100000000000000000000000000","000000100010000000000000000000000000000000000000","000000000000000000000000000000000000010001000000","000000000000000000000000001000000000000000000010","001000000000000000000010000000000000000000000000","000001000001000000000000000000000000000000000000","000000000000000000010000000010000000000000000000","000010000000000010000000000000000000000000000000","100000000100000000000000000000000000000000000000","000000000000000000000000000001000000000001000000","000000000000000000000000000000000000000000100001","000100000000000000000000000000000000010000000000","000000010000000000000000000000000000100000000000","000000000000000000000000000000000000000000010010","000000000000010000000000000100000000000000000000","000000000000001000000001000000000000000000000000","001000000000000000000000000000100000000000000000","000000000000000000000000000000000000000010001000","000000001000000000000000000000000010000000000000","000000000000000010000001000000000000000000000000","000000000000000100000000000100000000000000000000","000000000000100000000000000001000000000000000000","000000001000000000000000000000000100000000000000","000000000000000000000000001000000000001000000000","000000000000100000000010000000000000000000000000","000000000000000100000000000000100000000000000000"},{"0000000000000000000010000001000000000000000000","0000000000000100100000000000000000000000000000","0000000000000000000000000010000000010000000000","0000010000000000000000000000000000000100000000","0000000000000000000000000000001001000000000000","0000000000000000000000000000100000000000001000","0000000000000001000000000000000001000000000000","0000000000000000000000010001000000000000000000","0001000001000000000000000000000000000000000000","0000000000000010000000000000000000000100000000","0010000000000000010000000000000000000000000000","0000000000010000000000000000000000100000000000","0000101000000000000000000000000000000000000000","0000000000000000100000000000000000000000000010","0000000000000000000001000000000000001000000000","0000100000000000000000000000000000000001000000","0000000000000000000000000000000010000000000010","0000010000000000000000000000000000010000000000","1000000100000000000000000000000000000000000000","0010000000000000000000010000000000000000000000","0000000000000000000001000000000000000000000001","0000000000000000000000000100000100000000000000","0000000100000000000100000000000000000000000000","0000000000000000000000000010000000000010000000","0000000000000010000010000000000000000000000000","1000000000000000000000001000000000000000000000","0000000000000000000000100000000000000000000100","0000000000000000000000000000000000000010000001","0000000000100000000000000000000000000000100000","0100000000000100000000000000000000000000000000","0000001000000000000000000000000000000000010000","0000000001000000000000001000000000000000000000","0100000000000000000000000000010000000000000000","0000000000000000000000000000000000000001010000","0000000000010000000000000000000000100000000000","0000000000000000000000000000100000000000000100","0000000010000000000000000000000100000000000000","0000000000000000000000000000000000001000001000","0000000000000000001000100000000000000000000000","0000000000001000000000000000001000000000000000","0001000000000000010000000000000000000000000000","0000000000001001000000000000000000000000000000","0000000010000000000000000000000000000000100000","0000000000100000000100000000000000000000000000","0000000000000000000000000000010010000000000000","0000000000000000001000000100000000000000000000"},{"00000000000000001000000000100000000000000000","00000000000000000001000000000000001000000000","00000000010000000000000000000000000010000000","00000000000001000000000000100000000000000000","00000010000000000000000000000000000000100000","00001000000000000000000100000000000000000000","00000000000000000000000000000001000000010000","00100000000000001000000000000000000000000000","00000000000000010000000000000010000000000000","01000000000000000000000000000000000000000100","00000000000100000000000100000000000000000000","00000000000000010000000000000000010000000000","00000010000000000000000001000000000000000000","00000000100000000000000000000000000000001000","00000000000000100000000000000100000000000000","00000000000000000000000000000000100100000000","00000000000000000000000000000000000010000001","10010000000000000000000000000000000000000000","00000000000010000000001000000000000000000000","00000000000000000000001000000000000000000010","00000100001000000000000000000000000000000000","00000000000000000011000000000000000000000000","00000000000000000000000011000000000000000000","00000000000000000000000000000000010000100000","01000000000000000000010000000000000000000000","00000000000000000000010000000001000000000000","00000000000000000000000000000000000000001001","10000001000000000000000000000000000000000000","00000000100100000000000000000000000000000000","00000000000000100000000000000100000000000000","00010000000000000000000000000000000100000000","00000000000000000010000000000000000001000000","00000000001000000000000000001000000000000000","00000000000000000000100000000000100000000000","00100000000000000000000000000000000000000010","00000000000001000000000000001000000000000000","00000000000000000000000000010000000000000100","00001000000010000000000000000000000000000000","00000000000000000000100000000000000000010000","00000100000000000000000000000000000001000000","00000000000000000100000000000010000000000000","00000001000000000000000000000000001000000000","00000000010000000000000010000000000000000000","00000000000000000100000000010000000000000000"},{"000000000000000000001000000010000000000000","000000000001000001000000000000000000000000","000000000000000000000000110000000000000000","000000000000010000000000000001000000000000","000000000000000010000000000000010000000000","000000000000000000000110000000000000000000","000000000100000000000000000000000100000000","000000000000100000000000000000001000000000","000000100000000000000000000100000000000000","000000010000000000000000000000000001000000","000010000000000000000000000000100000000000","000000000010000000000000000000000000000010","000100000000000000000000000000000010000000","100000000000000000000000000000000000001000","000000001000000000000001000000000000000000","000000000000000000100010000000000000000000","001000000000000000000000000000000000010000","001000000000000000000000000000000000000010","000000000000001000000000001000000000000000","000001000000000100000000000000000000000000","000001000000000000000000000000000000000001","100000000000000000000000000000000000100000","000000000000000000000000001000000000100000","000000000000000100000000000100000000000000","010000000000000000000000000000000000000100","000010000000000000000000000000000000000100","000000000000000000010001000000000000000000","000000000000000000100000000000000100000000","000100000000000000000000000000000000000001","000000010000000000000000000000000000001000","010000000000000000000000000000010000000000","000000000001000000000000000000000000010000","000000100000000000000000000000000010000000","000000000000001000000000000000000001000000","000000000100000000000000000001000000000000","000000001000000000000000000000001000000000","000000000000000000011000000000000000000000","000000000010000000000000010000000000000000","000000000000100000000000000010000000000000","000000000000000011000000000000000000000000","000000000000000000000000100000100000000000","000000000000010000000100000000000000000000"},{"0000000000000000010000000000100000000000","0000000000000100000000010000000000000000","0000000010000000000000000000000001000000","0000000000000000000000001000000010000000","0000000000000000010000001000000000000000","0000000010000010000000000000000000000000","0010000100000000000000000000000000000000","0001000000000000000000000000000001000000","0000000000000000000000000000000000100100","0000000000001000000000000100000000000000","0000000000000000000000010001000000000000","1000000000000000000010000000000000000000","0000000000100000000000000000001000000000","0000000000000000001000000000000000000010","0000000001000000000000000000000000100000","0001100000000000000000000000000000000000","0100000000100000000000000000000000000000","0000000000000000000000000000000000010001","0000000000000000000010000010000000000000","0000000000010000001000000000000000000000","0000000000000000000001000000100000000000","0000000000000100000100000000000000000000","1000100000000000000000000000000000000000","0000000000000000000000000000010000000010","0000000000000000000000000000000000011000","0000010000000000000000000000001000000000","0100000000000000000001000000000000000000","0000000001000000000000000000010000000000","0000000000000000000100000000000000000001","0000000000001000100000000000000000000000","0000000000000010000000000001000000000000","0010010000000000000000000000000000000000","0000001000000000000000000000000000001000","0000000000000000000000000000000010000100","0000000000000000000000000100000100000000","0000000000000001000000100000000000000000","0000000100000001000000000000000000000000","0000001000000000000000000000000100000000","0000000000000000100000000010000000000000","0000000000010000000000100000000000000000"},{"00000000000000010001000000000000000000","00000000000000000000000001100000000000","00000000000000000001000000001000000000","00000000100000000000000000000000010000","00010010000000000000000000000000000000","00000000010000000000001000000000000000","00000000000000000000000000000010010000","00000010000000100000000000000000000000","00000000000000000000010000000000001000","00100000000000000000000000000000100000","00000000000001000000010000000000000000","01000000000001000000000000000000000000","01000000000000000100000000000000000000","00000000000000000000000000110000000000","00000000000000000100000000000010000000","00000100000000000000000000000000000001","00000000101000000000000000000000000000","00000000000000000000000101000000000000","10100000000000000000000000000000000000","00000000000000000000000000000000000101","00000000000010100000000000000000000000","00000000000000000000000000010100000000","10000000000000000000000000000000100000","00000001000000000000100000000000000000","00000000001100000000000000000000000000","00000000000000000000100000000000000010","00000000000000000000000010000000000010","00000000000000001000000010000000000000","00000100000000000000000000000000000100","00010000000000001000000000000000000000","00000000000000000000000100000001000000","00001001000000000000000000000000000000","00000000000000010000000000001000000000","00000000000000000000000000000001001000","00001000000000000000000000000100000000","00000000010000000010000000000000000000","00000000000110000000000000000000000000","00000000000000000010001000000000000000"},{"000000000000100100000000000000000000","000000000000000000000000011000000000","000000000000000000000000000001100000","000000000001000000000100000000000000","000000010000000000100000000000000000","001000000001000000000000000000000000","001000001000000000000000000000000000","000000000000000000000100000000010000","000000000000000000000000010001000000","010000000000000010000000000000000000","010000001000000000000000000000000000","000000000000000000000000000000101000","000000000000000001000000000000000001","000000000000010000000010000000000000","000100010000000000000000000000000000","000000000000000010000000000000000001","000000000000000000001000001000000000","000010000000000000000001000000000000","000000000000100000000000000000010000","000000000100000100000000000000000000","100000000000000000010000000000000000","000000000000000000000000000010001000","000000000000010000000010000000000000","100000000000000000100000000000000000","000101000000000000000000000000000000","000000000000000000000000000100000010","000000000000000000010000000000000010","000000100010000000000000000000000000","000010000000001000000000000000000000","000000000000000000000000000100000100","000000000000000000000000100000000100","000000000000000001000000000010000000","000000000000001000000000100000000000","000001100000000000000000000000000000","000000000110000000000000000000000000","000000000000000000001001000000000000"}};

a52=Map[ToExpression,Map[Characters,strings,{2}],{3}][[1]]

Visualization

ArrayPlot[a52,Mesh->True,PixelConstrained->True]

Check

In a row

Max[Length/@(Flatten[Position[#,1]]&/@a52)]

In a column

Max[Length/@(Flatten[Position[#,1]]&/@Transpose[a52])]

In any line

CollinearQ[x_List]:=Tr[Cross@@Transpose[x]]==0

Length[trips=Subsets[Range[52],{3}]]
Length[ones=Position[a52,1]]

Select[ones[[#]]&/@trips,CollinearQ]//Timing

No three in a line! :)