Cody

Problem 2595. Polite numbers. Politeness.

Solution 3145556

Submitted on 10 Oct 2020
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   Fail
x = 1; y_correct = 0; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

2   Fail
x = 2; y_correct = 0; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

3   Fail
x = 3; y_correct = 1; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

4   Fail
x = 7; y_correct = 1; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

5   Fail
x = 9; y_correct = 2; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

6   Fail
x = 15; y_correct = 3; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

7   Fail
x = 18; y_correct = 2; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

8   Fail
x = 21; y_correct = 3; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

9   Fail
x = 1024; y_correct = 0; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

10   Fail
x = 1025; y_correct = 5; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

11   Fail
x = 25215; y_correct = 11; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

12   Fail
x = 62; y_correct = 1; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

13   Fail
x = 63; y_correct = 5; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

14   Fail
x = 65; y_correct = 3; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

15   Fail
% anti-lookup & clue nums=primes(200); pattern=[1 nums([false ~randi([0 25],1,45)])]; x=prod(pattern)*2^randi([0 5]); y_correct=2^numel(pattern)/2-1; assert(isequal(politeness(x),y_correct))

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

16   Fail
for k=randi(2e4,1,20) assert(isequal(politeness(k*(k-1))+1,(politeness(k)+1)*(politeness(k-1)+1))) end

Error in solution: Line: 7 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "politeness".)

Community Treasure Hunt

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

Start Hunting!