6 kyu

Does my number look big in this?

74,014 of 183,812JulianNicholls

Description:

A Narcissistic Number (or Armstrong Number) is a positive number which is the sum of its own digits, each raised to the power of the number of digits in a given base. In this Kata, we will restrict ourselves to decimal (base 10).

For example, take 153 (3 digits), which is narcissistic:

    1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153

and 1652 (4 digits), which isn't:

    1^4 + 6^4 + 5^4 + 2^4 = 1 + 1296 + 625 + 16 = 1938

The Challenge:

Your code must return true or false (not 'true' and 'false') depending upon whether the given number is a Narcissistic number in base 10.

This may be True and False in your language, e.g. PHP.

Error checking for text strings or other invalid inputs is not required, only valid positive non-zero integers will be passed into the function.

Algorithms

More By Author:

Check out these other kata created by JulianNicholls

Stats:

CreatedNov 16, 2013
PublishedNov 16, 2013
Warriors Trained343211
Total Skips33925
Total Code Submissions485457
Total Times Completed183812
Ruby Completions5674
JavaScript Completions59370
CoffeeScript Completions244
Haskell Completions1476
Python Completions74014
C# Completions11091
PHP Completions5196
C++ Completions11902
NASM Completions30
Nim Completions36
Scala Completions609
C Completions4051
TypeScript Completions4577
COBOL Completions19
Factor Completions10
Lua Completions217
R Completions171
Java Completions7151
Swift Completions256
Rust Completions893
Crystal Completions9
Julia Completions50
D Completions7
Groovy Completions6
Total Stars1842
% of votes with a positive feedback rating92% of 15341
Total "Very Satisfied" Votes12917
Total "Somewhat Satisfied" Votes2258
Total "Not Satisfied" Votes166
Ad
Contributors
  • JulianNicholls Avatar
  • jhoffner Avatar
  • bkaes Avatar
  • samuelgarrett Avatar
  • donaldsebleung Avatar
  • ParanoidUser Avatar
  • Chrono79 Avatar
  • JohanWiltink Avatar
  • Voile Avatar
  • Madjosz Avatar
  • Souzooka Avatar
  • FArekkusu Avatar
  • markus.benko Avatar
  • hobovsky Avatar
  • uniapi Avatar
  • mouloud Avatar
  • xavierguihot Avatar
  • stellartux Avatar
  • aguspiza Avatar
  • WojciechMeller Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • Kacarott Avatar
  • tri@ Avatar
  • suyundukov Avatar
  • FranzMartyn Avatar
  • fcr-- Avatar
  • KayleighWasTaken Avatar
  • LuchoGabba Avatar
  • NoahNuebling Avatar
  • AmirTallap Avatar
Ad