Cody

Problem 83. Prime factor digits

Solution 2615206

Submitted on 26 Jun 2020 by 春樹 内糸
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
n = 2; p_correct = 1; assert(isequal(factor_digits(n),p_correct))

fs = 2 pl = [] pl = 2 p = 0 n = 1 p = 1 p = 1

2   Pass
n = 26; p_correct = [1 0 0 0 0 1]; assert(isequal(factor_digits(n),p_correct))

fs = 2 13 pl = [] pl = 2 pl = 2 3 pl = 2 3 5 pl = 2 3 5 7 pl = 2 3 5 7 11 pl = 2 3 5 7 11 13 p = 0 0 0 0 0 0 n = 13 p = 1 0 0 0 0 0 n = 1 p = 1 0 0 0 0 1 p = 1 0 0 0 0 1

3   Pass
n = 168; p_correct = [1 0 1 3]; assert(isequal(factor_digits(n),p_correct))

fs = 2 2 2 3 7 pl = [] pl = 2 pl = 2 3 pl = 2 3 5 pl = 2 3 5 7 p = 0 0 0 0 n = 84 p = 1 0 0 0 n = 42 p = 2 0 0 0 n = 21 p = 3 0 0 0 n = 7 p = 3 1 0 0 n = 1 p = 3 1 0 1 p = 1 0 1 3

4   Pass
n = 999; p_correct = [1 0 0 0 0 0 0 0 0 0 3 0]; assert(isequal(factor_digits(n),p_correct))

fs = 3 3 3 37 pl = [] pl = 2 pl = 2 3 pl = 2 3 5 pl = 2 3 5 7 pl = 2 3 5 7 11 pl = 2 3 5 7 11 13 pl = 2 3 5 7 11 13 17 pl = 2 3 5 7 11 13 17 19 pl = 2 3 5 7 11 13 17 19 23 pl = 2 3 5 7 11 13 17 19 23 29 pl = 2 3 5 7 11 13 17 19 23 29 31 pl = 2 3 5 7 11 13 17 19 23 29 31 37 p = 0 0 0 0 0 0 0 0 0 0 0 0 n = 333 p = 0 1 0 0 0 0 0 0 0 0 0 0 n = 111 p = 0 2 0 0 0 0 0 0 0 0 0 0 n = 37 p = 0 3 0 0 0 0 0 0 0 0 0 0 n = 1 p = 0 3 0 0 0 0 0 0 0 0 0 1 p = 1 0 0 0 0 0 0 0 0 0 3 0

Suggested Problems

More from this Author95

Community Treasure Hunt

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

Start Hunting!