The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation. Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A181018 Maximum number of 1's in an n X n binary matrix with no three 1's adjacent in a line along a row, column or diagonally. 4

%I

%S 1,4,6,9,16,20,26,36,42,52,64,74,86,100,114,130

%N Maximum number of 1's in an n X n binary matrix with no three 1's adjacent in a line along a row, column or diagonally.

%C Diagonal of A181019.

%C Three or more "1"s may be adjacent in an L-shape or step shape (cf. bottom of first example) or 2 X 2 square (top right of 2nd example) or similar. One possible (not always optimal) solution is therefore to fill the square with 2 X 2 squares of "1"s, separated by rows of "0"s: this yields the lower bound (n - floor(n/3))^2 = ceiling(2n/3)^2 given in FORMULA. I conjecture that this is optimal for n = 2 (mod 3) and that a(n) ~ (2n/3)^2. For n = 3k, the array can be filled with 2k(2k+1) "1"s by repeating the optimal solution for n = 3 on the diagonal, and filling the rest with 2 X 2 blocks separated by rows of "0"s, cf. the 4th example for 6 X 6. - _M. F. Hasler_, Jul 17 2015 [Conjecture proved to be wrong, see below. - _M. F. Hasler_, Jan 19 2016]

%C 74 <= a(12) <= 77. - _Manfred Scheucher_, Jul 23 2015

%C You can repeat a 4 X 2 block [1100; 0011] infinitely in both directions and then crop the needed square. That gives ceiling(n^2/2). It eventually surpasses the solutions we've found so far: at 17*17 the pattern above gives 12*12=144 but this one ceiling(17*17/2)=145. The credit for finding this goes to Jaakko Himberg. - _Juhani Heino_, Aug 11 2015

%H Manfred Scheucher, <a href="/A181018/a181018.py.txt">Python Script</a>

%H Peter J. Taylor, <a href="/A181018/a181018.java.txt">Java program to compute terms</a>

%F a(n) >= ceiling(2n/3)^2; a(3k) >= A002943(k) = 2k(2k+1). - _M. F. Hasler_, Jul 17 2015; revised by _Juhani Heino_, Aug 11 2015

%F a(n) >= ceiling(n^2/2). - _Juhani Heino_, Aug 11 2015

%e Some solutions for 6 X 6:

%e 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1

%e 1 0 1 0 0 1 1 0 1 0 1 1 1 0 1 0 0 1 1 0 1 0 1 1

%e 1 1 0 0 1 0 1 1 0 0 0 0 1 1 0 0 1 0 1 1 0 0 0 0

%e 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1

%e 1 0 1 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1

%e 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0

%e A solution with 73 ones for 12 X 12 (I replaced "0" with "." for readability):

%e 1 1 . 1 1 . 1 1 . 1 . 1

%e 1 1 . . 1 1 . 1 1 . 1 1

%e . . . 1 . . . . . . 1 .

%e 1 1 . 1 . 1 . 1 1 . . 1

%e . 1 1 . . 1 1 . . 1 1 .

%e 1 . . . 1 . 1 . 1 . . 1

%e 1 1 . . 1 1 . . 1 . 1 .

%e . 1 . 1 . 1 . 1 . . 1 1

%e 1 . . 1 1 . . 1 1 . . 1

%e . 1 . . . . 1 . 1 . 1 .

%e 1 1 . 1 1 . 1 1 . . 1 1

%e 1 . 1 . 1 1 . 1 . 1 . 1

%e - _Manfred Scheucher_, Jul 23 2015

%e An optimal solution with 74 ones (denoted by O) for 12 X 12 (also symmetric):

%e O . O . O . O O . O O .

%e O O . O O . . . O O . O

%e . O . O . O O . . . O O

%e O . . . O O . O O . O .

%e . O O . . . O . . . . O

%e O O . O O . O . O O . .

%e . . O O . O . O O . O O

%e O . . . . O . . . O O .

%e . O . O O . O O . . . O

%e O O . . . O O . O . O .

%e O . O O . . . O O . O O

%e . O O . O O . O . O . O - _Giovanni Resta_, Jul 29 2015

%o (MATLAB with CPLEX)

%o function v = A181018(n)

%o %

%o Grid = [1:n]' * ones(1,n) + n*ones(n,1)*[0:n-1];

%o f = -ones(n^2,1);

%o A = sparse(4*(n-2)*(n-1),n^2);

%o count = 0;

%o for i =1:n

%o for j = 1:n-2

%o count = count+1;

%o A(count, [Grid(i,j),Grid(i,j+1),Grid(i,j+2)]) = 1;

%o end

%o end

%o for i = 1:n-2

%o for j = 1:n

%o count = count+1;

%o A(count, [Grid(i,j),Grid(i+1,j),Grid(i+2,j)]) = 1;

%o end

%o end

%o for i = 1:n-2

%o for j = 1:n-2

%o count = count+2;

%o A(count-1,[Grid(i,j+2),Grid(i+1,j+1),Grid(i+2,j)]) = 1;

%o A(count, [Grid(i,j),Grid(i+1,j+1),Grid(i+2,j+2)]) = 1;

%o end

%o end

%o b = 2*ones(4*(n-2)*(n-1),1);

%o [x,v,exitflag,output] = cplexbilp(f,A,b);

%o end;

%o for n = 1:11

%o A(n) = A181018(n);

%o end

%o A % _Robert Israel_, Jan 14 2016

%Y Cf. A000769, A181019, A219760, A225623.

%K nonn,more,nice

%O 1,2

%A _R. H. Hardin_, Sep 30 2010

%E a(11)-a(12) from _M. F. Hasler_, Jul 20 2015

%E a(12) deleted by _Manfred Scheucher_, Jul 23 2015

%E a(12) from _Giovanni Resta_, Jul 29 2015

%E PARI code (which implemented a conjectured formula shown to underestimate) deleted by _Peter J. Taylor_, Jan 06 2016

%E a(13)-a(15) from _Peter J. Taylor_, Jan 09 2016

%E a(16) from _Peter J. Taylor_, Jan 14 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified August 3 20:08 EDT 2020. Contains 336201 sequences. (Running on oeis4.)