Cody

# Problem 2160. The 17x17 Problem

Solution 676541

Submitted on 28 May 2015 by Binbin Qi
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% n = 5; a = no_recs(n); d = size(a); assert(isequal(d,[n n])); % Only the numbers 1:4 tf = isempty(setdiff(a,[1 2 3 4])); assert(tf) % No rectangles tf = ~any(arrayfun(@(n)any(sum((a==n)'*double(a==n)>1)>1),1:4)); assert(tf)

[Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.]

2   Pass
%% n = 8; a = no_recs(n); d = size(a); assert(isequal(d,[n n])); % Only the numbers 1:4 tf = isempty(setdiff(a,[1 2 3 4])); assert(tf) % No rectangles tf = ~any(arrayfun(@(n)any(sum((a==n)'*double(a==n)>1)>1),1:4)); assert(tf)

[Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.]

3   Pass
%% n = 12; a = no_recs(n); d = size(a); assert(isequal(d,[n n])); % Only the numbers 1:4 tf = isempty(setdiff(a,[1 2 3 4])); assert(tf) % No rectangles tf = ~any(arrayfun(@(n)any(sum((a==n)'*double(a==n)>1)>1),1:4)); assert(tf)

[Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.]