Cody

# Problem 3075. Matrix of Multiplication Facts

Solution 2620930

Submitted on 27 Jun 2020 by Eric Mueller
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 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 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 = 432 12 288 36 0 24 288 8 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 = 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 = 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 = 113249 116477 62729 64517 y = 113249 269 116477 421 0 433 62729 149 64517

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 = 52369 97073 77617 58567 x = 1.0e+09 * 5.0836 4.0647 5.6853 4.5458 y = 1.0e+09 * 5.0836 0.0001 4.0647 0.0001 0 0.0001 5.6853 0.0001 4.5458

### Community Treasure Hunt

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

Start Hunting!