Cody

# Problem 2061. Narcissistic number ?

Solution 1936100

Submitted on 14 Sep 2019 by Doan Quang Manh
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))

a = '1' b = 1 tf = logical 1

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

a = '9' b = 9 tf = logical 1

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

a = '10' b = 1 b = 1 tf = logical 0

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

a = '99' b = 81 b = 162 tf = logical 0

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

a = '152' b = 1 b = 126 b = 134 tf = logical 0

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

a = '153' b = 1 b = 126 b = 153 tf = logical 1

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

a = '154' b = 1 b = 126 b = 190 tf = logical 0

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

a = '371' b = 27 b = 370 b = 371 tf = logical 1

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

a = '370' b = 27 b = 370 b = 370 tf = logical 1

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

a = '1634' b = 1 b = 1297 b = 1378 b = 1634 tf = logical 1

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

a = '8207' b = 4096 b = 4112 b = 4112 b = 6513 tf = logical 0

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

a = '9474' b = 6561 b = 6817 b = 9218 b = 9474 tf = logical 1

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

a = '9926315' b = 4782969 b = 9565938 b = 9566066 b = 9846002 b = 9848189 b = 9848190 b = 9926315 tf = logical 1

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

a = '88593477' b = 16777216 b = 33554432 b = 33945057 b = 76991778 b = 76998339 b = 77063875 b = 82828676 b = 88593477 tf = logical 1

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

a = '9800817' b = 4782969 b = 6880121 b = 6880121 b = 6880121 b = 8977273 b = 8977274 b = 9800817 tf = logical 1

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

a = '54748' b = 3125 b = 4149 b = 20956 b = 21980 b = 54748 tf = logical 1

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

a = '4679307774' b = 1048576 b = 61514752 b = 343990001 b = 3.8308e+09 b = 3.8308e+09 b = 3.8308e+09 b = 4.1133e+09 b = 4.3958e+09 b = 4.6783e+09 b = 4.6793e+09 tf = logical 1

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

a = '472335975' b = 262144 b = 40615751 b = 40616263 b = 40635946 b = 40655629 b = 42608754 b = 430029243 b = 470382850 b = 472335975 tf = logical 1

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

a = '32164049650' b = 177147 b = 179195 b = 179196 b = 362976252 b = 367170556 b = 367170556 b = 371364860 b = 3.1752e+10 b = 3.2115e+10 b = 3.2164e+10 b = 3.2164e+10 tf = logical 1

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

a = '32164049651' b = 177147 b = 179195 b = 179196 b = 362976252 b = 367170556 b = 367170556 b = 371364860 b = 3.1752e+10 b = 3.2115e+10 b = 3.2164e+10 b = 3.2164e+10 tf = logical 1

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

a = '32164049652' b = 177147 b = 179195 b = 179196 b = 362976252 b = 367170556 b = 367170556 b = 371364860 b = 3.1752e+10 b = 3.2115e+10 b = 3.2164e+10 b = 3.2164e+10 tf = logical 0