Cody

# Problem 3075. Matrix of Multiplication Facts

Solution 1822951

Submitted on 22 May 2019
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);

y = 6 0 8 0 0 0 15 0 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);

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

3   Fail
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);

y = 432 0 288 0 0 0 288 0 192 y = 432 144 288 144 0 96 288 96 192

Assertion failed.

4   Fail
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);

y = 21 0 63 0 0 0 15 0 45 y = 21 21 63 3 0 9 15 15 45

Assertion failed.

5   Fail
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);

y = 110 0 132 0 0 0 130 0 156 y = 110 22 132 10 0 12 130 26 156

Assertion failed.

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 = 114271 148163 344809 447077 y = 114271 0 148163 0 0 0 344809 0 447077 y = 114271 229 148163 499 0 647 344809 691 447077

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 = 73529 79301 74219 56533 x = 1.0e+09 * 5.8309 5.4572 4.4831 4.1958 y = 1.0e+09 * 5.8309 0 5.4572 0 0 0 4.4831 0 4.1958 y = 1.0e+09 * 5.8309 0.0001 5.4572 0.0001 0 0.0001 4.4831 0.0001 4.1958