From 07f18be4758f18496c7bf9405f7df9957c6bcf57 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Sat, 7 Dec 2024 22:29:24 +0000 Subject: [PATCH] solutions: 63 --- src/bin/powerful_digit_counts.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/bin/powerful_digit_counts.rs 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); +}