solutions: 56
This commit is contained in:
parent
c5dcb0eae6
commit
d7f2e29b83
14
src/bin/powerful_digit_sum.rs
Normal file
14
src/bin/powerful_digit_sum.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
use num_bigint::BigUint;
|
||||
|
||||
fn main() {
|
||||
let mut sums: Vec<u32> = vec![];
|
||||
|
||||
for i in 1..100 {
|
||||
for j in 1..100 {
|
||||
let power = format!("{}", BigUint::from(i as u64).pow(j));
|
||||
sums.push(power.chars().filter_map(|c| c.to_digit(10)).sum());
|
||||
}
|
||||
}
|
||||
|
||||
println!("{}", sums.iter().max().unwrap());
|
||||
}
|
Loading…
Reference in a new issue