Cody

# Problem 2061. Narcissistic number ?

Solution 807296

Submitted on 15 Jan 2016 by David Schafer
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))

dat = 1 le = 1 s = 1

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

dat = 9 le = 1 s = 9

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

dat = 1 0 le = 2 s = 1 s = 1 0

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

dat = 9 9 le = 2 s = 81 s = 81 81

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

dat = 1 5 2 le = 3 s = 1 s = 1 125 s = 1 125 8

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

dat = 1 5 3 le = 3 s = 1 s = 1 125 s = 1 125 27

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

dat = 1 5 4 le = 3 s = 1 s = 1 125 s = 1 125 64

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

dat = 3 7 1 le = 3 s = 27 s = 27 343 s = 27 343 1

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

dat = 3 7 0 le = 3 s = 27 s = 27 343 s = 27 343 0

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

dat = 1 6 3 4 le = 4 s = 1 s = 1 1296 s = 1 1296 81 s = 1 1296 81 256

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

dat = 8 2 0 7 le = 4 s = 4096 s = 4096 16 s = 4096 16 0 s = 4096 16 0 2401

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

dat = 9 4 7 4 le = 4 s = 6561 s = 6561 256 s = 6561 256 2401 s = 6561 256 2401 256

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

dat = 9 9 2 6 3 1 5 le = 7 s = 4782969 s = 4782969 4782969 s = 4782969 4782969 128 s = 4782969 4782969 128 279936 s = 4782969 4782969 128 279936 2187 s = 4782969 4782969 128 279936 2187 1 s = 4782969 4782969 128 279936 2187 1 78125

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

dat = 8 8 5 9 3 4 7 7 le = 8 s = 16777216 s = 16777216 16777216 s = 16777216 16777216 390625 s = 16777216 16777216 390625 43046721 s = 16777216 16777216 390625 43046721 6561 s = 16777216 16777216 390625 43046721 6561 65536 s = 16777216 16777216 390625 43046721 6561 65536 5764801 s = 16777216 16777216 390625 43046721 6561 65536 5764801 5764801

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

dat = 9 8 0 0 8 1 7 le = 7 s = 4782969 s = 4782969 2097152 s = 4782969 2097152 0 s = 4782969 2097152 0 0 s = 4782969 2097152 0 0 2097152 s = 4782969 2097152 0 0 2097152 1 s = 4782969 2097152 0 0 2097152 1 823543

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

dat = 5 4 7 4 8 le = 5 s = 3125 s = 3125 1024 s = 3125 1024 16807 s = 3125 1024 16807 1024 s = 3125 1024 16807 1024 32768

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

dat = 4 6 7 9 3 0 7 7 7 4 le = 10 s = 1048576 s = 1048576 60466176 s = 1048576 60466176 282475249 s = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 s = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 0.0001 s = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 0.0001 0 s = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 0.0001 0 0.2825 s = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 0.0001 0 0.2825 0.2825 s = 1.0e+09 * 0.0010 0.0605 0.2825 3.4868 0.0001 0 0.2825 0.2825 0.2825 s = 1.0e+09 * Columns 1 through 9 0.0010 0.0605 0.2825 3.4868 0.0001 0 0.2825 0.2825 0.2825 Column 10 0.0010

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

dat = 4 7 2 3 3 5 9 7 5 le = 9 s = 262144 s = 262144 40353607 s = 262144 40353607 512 s = 262144 40353607 512 19683 s = 262144 40353607 512 19683 19683 s = 262144 40353607 512 19683 19683 1953125 s = 262144 40353607 512 19683 19683 1953125 387420489 s = 262144 40353607 512 19683 19683 1953125 387420489 40353607 s = Columns 1 through 8 262144 40353607 512 19683 19683 1953125 387420489 40353607 Column 9 1953125

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

dat = 3 2 1 6 4 0 4 9 6 5 0 le = 11 s = 177147 s = 177147 2048 s = 177147 2048 1 s = 177147 2048 1 362797056 s = 177147 2048 1 362797056 4194304 s = 177147 2048 1 362797056 4194304 0 s = 177147 2048 1 362797056 4194304 0 4194304 s = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 s = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 s = 1.0e+10 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 Column 10 0.0049 s = 1.0e+10 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 Columns 10 through 11 0.0049 0

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

dat = 3 2 1 6 4 0 4 9 6 5 1 le = 11 s = 177147 s = 177147 2048 s = 177147 2048 1 s = 177147 2048 1 362797056 s = 177147 2048 1 362797056 4194304 s = 177147 2048 1 362797056 4194304 0 s = 177147 2048 1 362797056 4194304 0 4194304 s = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 s = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 s = 1.0e+10 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 Column 10 0.0049 s = 1.0e+10 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 Columns 10 through 11 0.0049 0.0000

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

dat = 3 2 1 6 4 0 4 9 6 5 2 le = 11 s = 177147 s = 177147 2048 s = 177147 2048 1 s = 177147 2048 1 362797056 s = 177147 2048 1 362797056 4194304 s = 177147 2048 1 362797056 4194304 0 s = 177147 2048 1 362797056 4194304 0 4194304 s = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 s = 1.0e+10 * 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 s = 1.0e+10 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 Column 10 0.0049 s = 1.0e+10 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0363 0.0004 0 0.0004 3.1381 0.0363 Columns 10 through 11 0.0049 0.0000