Cody

Problem 42830. Hilbert numbers

Solution 2243327

Submitted on 29 Apr 2020 by Simone Corti
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 = 3; h_correct = 0; assert(isequal(hilbertnum(n),h_correct))

2   Pass
n = 5; h_correct = 1; assert(isequal(hilbertnum(n),h_correct))

3   Pass
n = 45; h_correct = [5 9]; assert(isequal(hilbertnum(n),h_correct))

h = 5 h = 5 9

4   Pass
n = 1169; h_correct = 1; assert(isequal(hilbertnum(n),h_correct))

5   Pass
n = 441; h_correct = [9 21 49]; assert(isequal(hilbertnum(n),h_correct))

h = 9 h = 9 21 h = 9 21 49

6   Pass
n = 45678; h_correct = 0; assert(isequal(hilbertnum(n),h_correct))

7   Pass
n = 56789; h_correct = [109 521]; assert(isequal(hilbertnum(n),h_correct))

h = 109 h = 109 521

8   Pass
n = 353535; h_correct = 0; assert(isequal(hilbertnum(n),h_correct))

9   Pass
n = 35353549; h_correct = [49 77 613 749 1177 30037 47201 57673 459137 721501]; assert(isequal(hilbertnum(n),h_correct))

h = 49 h = 49 77 h = 49 77 613 h = 49 77 613 749 h = 49 77 613 749 1177 h = 49 77 613 749 1177 30037 h = 49 77 613 749 1177 30037 47201 h = 49 77 613 749 1177 30037 47201 57673 h = 49 77 613 749 1177 30037 47201 57673 459137 h = 49 77 613 749 1177 30037 47201 57673 459137 721501

Suggested Problems

More from this Author34

Community Treasure Hunt

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

Start Hunting!