Responses for exercises in Exercism.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
pub fn is_armstrong_number(num: u32) -> bool { |
|
let str_num = num.to_string(); |
|
let num_digits = str_num.len() as u32; |
|
num == str_num |
|
.chars() |
|
.map(|x| x.to_digit(10).unwrap()) |
|
.map(|n| n.pow(num_digits)) |
|
.sum() |
|
}
|
|
|