Skip to main content

is_armstrong

Function is_armstrong 

Source
pub fn is_armstrong(n: u64) -> bool
Expand description

Check if n is an Armstrong (Narcissistic) number: n = sum of its digits each raised to the power of the number of digits.

ยงExamples

use mathverse_core::integer::is_armstrong;

assert!(is_armstrong(153));
assert!(!is_armstrong(154));