Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 828 Bytes

File metadata and controls

21 lines (14 loc) · 828 Bytes

水仙花数

一个Armstrong number是一个数字,它是自身每个单数字与数字量的幂,之和。

例如:

  • 9 是水仙花数,因为9 = 9^1 = 9
  • 10 不是一个水仙花数,因为10 != 1^2 + 0^2 = 1
  • 153 是水仙花数,因为:153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153
  • 154 不是一个水仙花数,因为:154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190

写一些代码来确定一个数字是否水仙花数.

资源

维基百科https://en.wikipedia.org/wiki/Narcissistic_number