Cody

# Problem 2061. Narcissistic number ?

Solution 807978

Submitted on 16 Jan 2016 by Shishir Patel
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 = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 1 l = 1 sum = 0 sum = 1 y = 1

2   Pass
%% x = 9; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 9 l = 1 sum = 0 sum = 9 y = 1

3   Pass
%% x = 10; y_correct = false; assert(isequal(isnarcissistic(x),y_correct))

x_str = 10 l = 2 sum = 0 sum = 1 sum = 1 y = 0

4   Pass
%% x = 99; y_correct = false; assert(isequal(isnarcissistic(x),y_correct))

x_str = 99 l = 2 sum = 0 sum = 81 sum = 162 y = 0

5   Pass
%% x = 152; y_correct = false; assert(isequal(isnarcissistic(x),y_correct))

x_str = 152 l = 3 sum = 0 sum = 1 sum = 126 sum = 134 y = 0

6   Pass
%% x = 153; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 153 l = 3 sum = 0 sum = 1 sum = 126 sum = 153 y = 1

7   Pass
%% x = 154; y_correct = false; assert(isequal(isnarcissistic(x),y_correct))

x_str = 154 l = 3 sum = 0 sum = 1 sum = 126 sum = 190 y = 0

8   Pass
%% x = 371; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 371 l = 3 sum = 0 sum = 27 sum = 370 sum = 371 y = 1

9   Pass
%% x = 370; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 370 l = 3 sum = 0 sum = 27 sum = 370 sum = 370 y = 1

10   Pass
%% x = 1634; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 1634 l = 4 sum = 0 sum = 1 sum = 1297 sum = 1378 sum = 1634 y = 1

11   Pass
%% x = 8207; y_correct = false; assert(isequal(isnarcissistic(x),y_correct))

x_str = 8207 l = 4 sum = 0 sum = 4096 sum = 4112 sum = 4112 sum = 6513 y = 0

12   Pass
%% x = 9474; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 9474 l = 4 sum = 0 sum = 6561 sum = 6817 sum = 9218 sum = 9474 y = 1

13   Pass
%% x = 9926315; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 9926315 l = 7 sum = 0 sum = 4782969 sum = 9565938 sum = 9566066 sum = 9846002 sum = 9848189 sum = 9848190 sum = 9926315 y = 1

14   Pass
%% x = 88593477; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 88593477 l = 8 sum = 0 sum = 16777216 sum = 33554432 sum = 33945057 sum = 76991778 sum = 76998339 sum = 77063875 sum = 82828676 sum = 88593477 y = 1

15   Pass
%% x = 9800817; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 9800817 l = 7 sum = 0 sum = 4782969 sum = 6880121 sum = 6880121 sum = 6880121 sum = 8977273 sum = 8977274 sum = 9800817 y = 1

16   Pass
%% x = 54748; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 54748 l = 5 sum = 0 sum = 3125 sum = 4149 sum = 20956 sum = 21980 sum = 54748 y = 1

17   Pass
%% x = 4679307774; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 4679307774 l = 10 sum = 0 sum = 1048576 sum = 61514752 sum = 343990001 sum = 3.8308e+09 sum = 3.8308e+09 sum = 3.8308e+09 sum = 4.1133e+09 sum = 4.3958e+09 sum = 4.6783e+09 sum = 4.6793e+09 y = 1

18   Pass
%% x = 472335975; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 472335975 l = 9 sum = 0 sum = 262144 sum = 40615751 sum = 40616263 sum = 40635946 sum = 40655629 sum = 42608754 sum = 430029243 sum = 470382850 sum = 472335975 y = 1

19   Pass
%% x = 32164049650; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 32164049650 l = 11 sum = 0 sum = 177147 sum = 179195 sum = 179196 sum = 362976252 sum = 367170556 sum = 367170556 sum = 371364860 sum = 3.1752e+10 sum = 3.2115e+10 sum = 3.2164e+10 sum = 3.2164e+10 y = 1

20   Pass
%% x = 32164049651; y_correct = true; assert(isequal(isnarcissistic(x),y_correct))

x_str = 32164049651 l = 11 sum = 0 sum = 177147 sum = 179195 sum = 179196 sum = 362976252 sum = 367170556 sum = 367170556 sum = 371364860 sum = 3.1752e+10 sum = 3.2115e+10 sum = 3.2164e+10 sum = 3.2164e+10 y = 1

21   Pass
%% x = 32164049652; y_correct = false; assert(isequal(isnarcissistic(x),y_correct))

x_str = 32164049652 l = 11 sum = 0 sum = 177147 sum = 179195 sum = 179196 sum = 362976252 sum = 367170556 sum = 367170556 sum = 371364860 sum = 3.1752e+10 sum = 3.2115e+10 sum = 3.2164e+10 sum = 3.2164e+10 y = 0