6 kyu

Does my number look big in this?

74,808 of 185,707JulianNicholls

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 Trained347102
Total Skips34172
Total Code Submissions489848
Total Times Completed185707
Ruby Completions5688
JavaScript Completions59871
CoffeeScript Completions244
Haskell Completions1481
Python Completions74808
C# Completions11191
PHP Completions5243
C++ Completions12013
NASM Completions31
Nim Completions36
Scala Completions609
C Completions4100
TypeScript Completions4666
COBOL Completions19
Factor Completions10
Lua Completions224
R Completions174
Java Completions7348
Swift Completions261
Rust Completions926
Crystal Completions9
Julia Completions51
D Completions8
Groovy Completions6
Total Stars1859
% of votes with a positive feedback rating92% of 15444
Total "Very Satisfied" Votes13001
Total "Somewhat Satisfied" Votes2276
Total "Not Satisfied" Votes167
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