Cody

# Problem 3075. Matrix of Multiplication Facts

Solution 1766252

Submitted on 29 Mar 2019 by Vishal
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 = 0 0 0 0 0 0 0 0 0 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 = 0 0 0 0 0 0 0 0 0 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);

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

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

y = 0 0 0 0 0 0 0 0 0 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 = 239549 242917 221341 224453 y = 0 0 0 0 0 0 0 0 0 y = 239549 421 242917 569 0 577 221341 389 224453

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 = 96479 53171 98993 81359 x = 1.0e+09 * 5.1299 9.5507 4.3259 8.0540 y = 0 0 0 0 0 0 0 0 0 y = 1.0e+09 * 5.1299 0.0001 9.5507 0.0001 0 0.0001 4.3259 0.0001 8.0540

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!