Cody

# Problem 1025. Divisors of an integer

Solution 363644

Submitted on 3 Dec 2013 by Hamza
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 = 1; y_correct = 1; assert(isequal(divisor(x),y_correct))

a = 1 V = 0 d = 1 V = 1 e = [] V = 1 V = 1

2   Pass
%% x = 12; y_correct = [1 2 3 4 6 12]; assert(isequal(divisor(x),y_correct))

a = 1 2 3 4 5 6 7 8 9 10 11 12 V = 0 0 0 0 0 0 0 0 0 0 0 0 d = 12 V = 12 0 0 0 0 0 0 0 0 0 0 0 e = 2 3 4 5 6 7 8 9 10 11 12 V = 12 V = 12 d = 6 V = 12 6 e = Empty matrix: 1-by-0 V = 12 6 V = 6 12 d = 4 V = 6 12 4 e = Empty matrix: 1-by-0 V = 6 12 4 V = 4 6 12 d = 3 V = 4 6 12 3 e = Empty matrix: 1-by-0 V = 4 6 12 3 V = 3 4 6 12 d = 2 + 1/(3 + 1/(-2)) ans = 0 e = Empty matrix: 1-by-0 V = 3 4 6 12 V = 3 4 6 12 d = 2 V = 3 4 6 12 0 2 e = 5 V = 3 4 6 12 2 V = 2 3 4 6 12 d = 2 + 1/(-3 + 1/(-2)) ans = 0 e = Empty matrix: 1-by-0 V = 2 3 4 6 12 V = 2 3 4 6 12 d = 2 + 1/(-2) ans = 0 e = Empty matrix: 1-by-0 V = 2 3 4 6 12 V = 2 3 4 6 12 d = 1 + 1/(3) ans = 0 e = Empty matrix: 1-by-0 V = 2 3 4 6 12 V = 2 3 4 6 12 d = 1 + 1/(5) ans = 0 e = Empty matrix: 1-by-0 V = 2 3 4 6 12 V = 2 3 4 6 12 d = 1 + 1/(11) ans = 0 e = Empty matrix: 1-by-0 V = 2 3 4 6 12 V = 2 3 4 6 12 d = 1 V = 2 3 4 6 12 0 0 0 0 0 0 1 e = 6 7 8 9 10 11 V = 2 3 4 6 12 1 V = 1 2 3 4 6 12

3   Pass
%% x = 10; y_correct = [1 2 5 10]; assert(isequal(divisor(x),y_correct))

a = 1 2 3 4 5 6 7 8 9 10 V = 0 0 0 0 0 0 0 0 0 0 d = 10 V = 10 0 0 0 0 0 0 0 0 0 e = 2 3 4 5 6 7 8 9 10 V = 10 V = 10 d = 5 V = 10 5 e = Empty matrix: 1-by-0 V = 10 5 V = 5 10 d = 3 + 1/(3) ans = 0 e = Empty matrix: 1-by-0 V = 5 10 V = 5 10 d = 3 + 1/(-2) ans = 0 e = Empty matrix: 1-by-0 V = 5 10 V = 5 10 d = 2 V = 5 10 0 0 2 e = 3 4 V = 5 10 2 V = 2 5 10 d = 2 + 1/(-3) ans = 0 e = Empty matrix: 1-by-0 V = 2 5 10 V = 2 5 10 d = 1 + 1/(2 + 1/(3)) ans = 0 e = Empty matrix: 1-by-0 V = 2 5 10 V = 2 5 10 d = 1 + 1/(4) ans = 0 e = Empty matrix: 1-by-0 V = 2 5 10 V = 2 5 10 d = 1 + 1/(9) ans = 0 e = Empty matrix: 1-by-0 V = 2 5 10 V = 2 5 10 d = 1 V = 2 5 10 0 0 0 0 0 0 1 e = 4 5 6 7 8 9 V = 2 5 10 1 V = 1 2 5 10