Narcissistic number ? - MATLAB Cody - MATLAB Central

Problem 2061. Narcissistic number ?

Difficulty:Rate

Inspired by Problem 2056 created by Ted.

In recreational number theory, a narcissistic number is a number that is the sum of its own digits each raised to the power of the number of digits (Wikipedia).

For example :

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

1634 = 1^4+6^4+3^4+4^4 = 1 + 1296 + 81 + 256 = 1634 are narcissistic numbers.

Simply return 1 (true) if a supplied number is narcissistic or 0 (false) if not.

The tips num2str(666)-'0' = [6 6 6] should be useful.

Solution Stats

54.44% Correct | 45.56% Incorrect
Last Solution submitted on May 13, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
7
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Group

Number theory Image
Number theory
  • 44 Problems
  • 21 Finishers

Problem Recent Solvers335

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page