diff --git a/src/bin/powerful_digit_counts.rs b/src/bin/powerful_digit_counts.rs new file mode 100644 index 0000000..4ea7151 --- /dev/null +++ b/src/bin/powerful_digit_counts.rs @@ -0,0 +1,15 @@ +use num_bigint::BigUint; + +fn main() { + let mut count = 0; + for i in 1..=9 { + for j in 1..=100 { + let length = BigUint::from(i as u64).pow(j).to_string().len(); + if length == j.try_into().unwrap() { + count += 1; + } + } + } + + println!("{}", count); +}