Cody

# Problem 2061. Narcissistic number ?

Solution 1593419

Submitted on 27 Jul 2018 by Srishti Saha
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 n = 1 a_sq = [] append = 1 a_sq = 1 ans = logical 1

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

a = 9 n = 1 a_sq = [] append = 9 a_sq = 9 ans = logical 1

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

a = 1 0 n = 2 a_sq = [] append = 1 a_sq = 1 append = 0 a_sq = 1 0 ans = logical 0

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

a = 9 9 n = 2 a_sq = [] append = 81 a_sq = 81 append = 81 a_sq = 81 81 ans = logical 0

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

a = 1 5 2 n = 3 a_sq = [] append = 1 a_sq = 1 append = 125 a_sq = 1 125 append = 8 a_sq = 1 125 8 ans = logical 0

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

a = 1 5 3 n = 3 a_sq = [] append = 1 a_sq = 1 append = 125 a_sq = 1 125 append = 27 a_sq = 1 125 27 ans = logical 1

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

a = 1 5 4 n = 3 a_sq = [] append = 1 a_sq = 1 append = 125 a_sq = 1 125 append = 64 a_sq = 1 125 64 ans = logical 0

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

a = 3 7 1 n = 3 a_sq = [] append = 27 a_sq = 27 append = 343 a_sq = 27 343 append = 1 a_sq = 27 343 1 ans = logical 1

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

a = 3 7 0 n = 3 a_sq = [] append = 27 a_sq = 27 append = 343 a_sq = 27 343 append = 0 a_sq = 27 343 0 ans = logical 1

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

a = 1 6 3 4 n = 4 a_sq = [] append = 1 a_sq = 1 append = 1296 a_sq = 1 1296 append = 81 a_sq = 1 1296 81 append = 256 a_sq = 1 1296 81 256 ans = logical 1

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

a = 8 2 0 7 n = 4 a_sq = [] append = 4096 a_sq = 4096 append = 16 a_sq = 4096 16 append = 0 a_sq = 4096 16 0 append = 2401 a_sq = 4096 16 0 2401 ans = logical 0

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

a = 9 4 7 4 n = 4 a_sq = [] append = 6561 a_sq = 6561 append = 256 a_sq = 6561 256 append = 2401 a_sq = 6561 256 2401 append = 256 a_sq = 6561 256 2401 256 ans = logical 1

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

a = 9 9 2 6 3 1 5 n = 7 a_sq = [] append = 4782969 a_sq = 4782969 append = 4782969 a_sq = 4782969 4782969 append = 128 a_sq = 4782969 4782969 128 append = 279936 a_sq = 4782969 4782969 128 279936 append = 2187 a_sq = 4782969 4782969 128 279936 2187 append = 1 a_sq = 4782969 4782969 128 279936 2187 1 append = 78125 a_sq = 4782969 4782969 128 279936 2187 1 78125 ans = logical 1

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

a = 8 8 5 9 3 4 7 7 n = 8 a_sq = [] append = 16777216 a_sq = 16777216 append = 16777216 a_sq = 16777216 16777216 append = 390625 a_sq = 16777216 16777216 390625 append = 43046721 a_sq = 16777216 16777216 390625 43046721 append = 6561 a_sq = 16777216 16777216 390625 43046721 6561 append = 65536 a_sq = 16777216 16777216 390625 43046721 6561 65536 append = 5764801 a_sq = 16777216 16777216 390625 43046721 6561 65536 5764801 append = 5764801 a_sq = 16777216 16777216 390625 43046721 6561 65536 5764801 5764801 ans = logical 1

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

a = 9 8 0 0 8 1 7 n = 7 a_sq = [] append = 4782969 a_sq = 4782969 append = 2097152 a_sq = 4782969 2097152 append = 0 a_sq = 4782969 2097152 0 append = 0 a_sq = 4782969 2097152 0 0 append = 2097152 a_sq = 4782969 2097152 0 0 2097152 append = 1 a_sq = 4782969 2097152 0 0 2097152 1 append = 823543 a_sq = 4782969 2097152 0 0 2097152 1 823543 ans = logical 1

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

a = 5 4 7 4 8 n = 5 a_sq = [] append = 3125 a_sq = 3125 append = 1024 a_sq = 3125 1024 append = 16807 a_sq = 3125 1024 16807 append = 1024 a_sq = 3125 1024 16807 1024 append = 32768 a_sq = 3125 1024 16807 1024 32768 ans = logical 1

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

a = 4 6 7 9 3 0 7 7 7 4 n = 10 a_sq = [] append = 1048576 a_sq = 1048576 append = 60466176 a_sq = 1048576 60466176 append = 282475249 a_sq = 1048576 60466176 282475249 append = 3.4868e+09 a_sq = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 append = 59049 a_sq = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 0.0001 append = 0 a_sq = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 0.0001 0 append = 282475249 a_sq = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 0.0001 0 0.2825 append = 282475249 a_sq = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 0.0001 0 0.2825 0.2825 append = 282475249 a_sq = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 0.0001 0 0.2825 0.2825 0.2825 append = 1048576 a_sq = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 0.0001 0 0.2825 0.2825 0.2825 0.0010 ans = logical 1

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

a = 4 7 2 3 3 5 9 7 5 n = 9 a_sq = [] append = 262144 a_sq = 262144 append = 40353607 a_sq = 262144 40353607 append = 512 a_sq = 262144 40353607 512 append = 19683 a_sq = 262144 40353607 512 19683 append = 19683 a_sq = 262144 40353607 512 19683 19683 append = 1953125 a_sq = 262144 40353607 512 19683 19683 1953125 append = 387420489 a_sq = 262144 40353607 512 19683 19683 1953125 387420489 append = 40353607 a_sq = 262144 40353607 512 19683 19683 1953125 387420489 40353607 append = 1953125 a_sq = 262144 40353607 512 19683 19683 1953125 387420489 40353607 1953125 ans = logical 1

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

a = 3 2 1 6 4 0 4 9 6 5 0 n = 11 a_sq = [] append = 177147 a_sq = 177147 append = 2048 a_sq = 177147 2048 append = 1 a_sq = 177147 2048 1 append = 362797056 a_sq = 177147 2048 1 362797056 append = 4194304 a_sq = 177147 2048 1 362797056 4194304 append = 0 a_sq = 177147 2048 1 362797056 4194304 0 append = 4194304 a_sq = 177147 2048 1 362797056 4194304 0 4194304 append = 3.1381e+10 a_sq = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 append = 362797056 a_sq = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 append = 48828125 a_sq = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 0.0049 append = 0 a_sq = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 0.0049 0 ans = logical 1

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

a = 3 2 1 6 4 0 4 9 6 5 1 n = 11 a_sq = [] append = 177147 a_sq = 177147 append = 2048 a_sq = 177147 2048 append = 1 a_sq = 177147 2048 1 append = 362797056 a_sq = 177147 2048 1 362797056 append = 4194304 a_sq = 177147 2048 1 362797056 4194304 append = 0 a_sq = 177147 2048 1 362797056 4194304 0 append = 4194304 a_sq = 177147 2048 1 362797056 4194304 0 4194304 append = 3.1381e+10 a_sq = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 append = 362797056 a_sq = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 append = 48828125 a_sq = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 0.0049 append = 1 a_sq = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 0.0049 0.0000 ans = logical 1

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

a = 3 2 1 6 4 0 4 9 6 5 2 n = 11 a_sq = [] append = 177147 a_sq = 177147 append = 2048 a_sq = 177147 2048 append = 1 a_sq = 177147 2048 1 append = 362797056 a_sq = 177147 2048 1 362797056 append = 4194304 a_sq = 177147 2048 1 362797056 4194304 append = 0 a_sq = 177147 2048 1 362797056 4194304 0 append = 4194304 a_sq = 177147 2048 1 362797056 4194304 0 4194304 append = 3.1381e+10 a_sq = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 append = 362797056 a_sq = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 append = 48828125 a_sq = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 0.0049 append = 2048 a_sq = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 0.0049 0.0000 ans = logical 0