Skip to main content

is_harshad

Function is_harshad 

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

Check if n is a Harshad (Niven) number: divisible by sum of its digits.

ยงExamples

use mathverse_core::integer::is_harshad;

assert!(is_harshad(18));
assert!(!is_harshad(16));