Cody

# Problem 3075. Matrix of Multiplication Facts

Solution 594306

Submitted on 10 Mar 2015 by goc3
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
%% x = [6 8 ; 15 20]; y=factor_square(x) assert(all(y(:)==round(y(:)))) assert(isequal(y(2)*y(4),x(1))) assert(isequal(y(2)*y(6),x(2))) assert(isequal(y(4)*y(8),x(3))) assert(isequal(y(6)*y(8),x(4))) assert(size(y,1)==3); assert(size(y,2)==3);

ans = 21 3 6 7 0 2 35 5 10 y = 21 3 6 7 0 2 35 5 10 ans = 6 2 8 3 0 4 15 5 20 y = 6 2 8 3 0 4 15 5 20

2   Pass
%% x=[35 42 ; 15 18]; y=factor_square(x) assert(all(y(:)==round(y(:)))) assert(isequal(y(2)*y(4),x(1))) assert(isequal(y(2)*y(6),x(2))) assert(isequal(y(4)*y(8),x(3))) assert(isequal(y(6)*y(8),x(4))) assert(size(y,1)==3); assert(size(y,2)==3);

ans = 35 7 42 5 0 6 15 3 18 y = 35 7 42 5 0 6 15 3 18

3   Pass
%% x = [432 288 ; 288 192]; y=factor_square(x) assert(all(y(:)==round(y(:)))) assert(isequal(y(2)*y(4),x(1))) assert(isequal(y(2)*y(6),x(2))) assert(isequal(y(4)*y(8),x(3))) assert(isequal(y(6)*y(8),x(4))) assert(size(y,1)==3); assert(size(y,2)==3);

ans = 432 3 288 144 0 96 288 2 192 y = 432 3 288 144 0 96 288 2 192

4   Pass
%% x = [21 63 ; 15 45]; y=factor_square(x) assert(all(y(:)==round(y(:)))) assert(isequal(y(2)*y(4),x(1))) assert(isequal(y(2)*y(6),x(2))) assert(isequal(y(4)*y(8),x(3))) assert(isequal(y(6)*y(8),x(4))) assert(size(y,1)==3); assert(size(y,2)==3);

ans = 21 7 63 3 0 9 15 5 45 y = 21 7 63 3 0 9 15 5 45

5   Pass
%% x = [110 132 ; 130 156]; y=factor_square(x) assert(all(y(:)==round(y(:)))) assert(isequal(y(2)*y(4),x(1))) assert(isequal(y(2)*y(6),x(2))) assert(isequal(y(4)*y(8),x(3))) assert(isequal(y(6)*y(8),x(4))) assert(size(y,1)==3); assert(size(y,2)==3);

ans = 110 11 132 10 0 12 130 13 156 y = 110 11 132 10 0 12 130 13 156

6   Pass
%% p=primes(1000); j=randperm(numel(p)); p=p(j(1:4)); x=[p(1)*p(2) p(1)*p(3) ; p(2)*p(4) p(3)*p(4)] y=factor_square(x) assert(all(y(:)==round(y(:)))) assert(isequal(y(2)*y(4),x(1))) assert(isequal(y(2)*y(6),x(2))) assert(isequal(y(4)*y(8),x(3))) assert(isequal(y(6)*y(8),x(4))) assert(size(y,1)==3); assert(size(y,2)==3);

x = 161131 391147 261199 634063 ans = 161131 599 391147 269 0 653 261199 971 634063 y = 161131 599 391147 269 0 653 261199 971 634063

7   Pass
%% p=primes(100000); p(p<50000)=[]; j=randperm(numel(p)); p=p(j(1:4)) x=[p(1)*p(2) p(1)*p(3) ; p(2)*p(4) p(3)*p(4)] y=factor_square(x) assert(all(y(:)==round(y(:)))) assert(isequal(y(2)*y(4),x(1))) assert(isequal(y(2)*y(6),x(2))) assert(isequal(y(4)*y(8),x(3))) assert(isequal(y(6)*y(8),x(4)))

p = 94747 55217 50129 81083 x = 1.0e+09 * 5.2316 4.7496 4.4772 4.0646 ans = 1.0e+09 * 5.2316 0.0001 4.7496 0.0001 0 0.0001 4.4772 0.0001 4.0646 y = 1.0e+09 * 5.2316 0.0001 4.7496 0.0001 0 0.0001 4.4772 0.0001 4.0646