extern crate num_bigint; // extern crate num_traits; use num_bigint::BigUint; fn main() { let mut num = BigUint::from(0 as u8); num = num + 277777788888899u128; println!("{:?}", test(num)); } fn test(input: BigUint) -> u8 { let mut n = factorize(input); let mut counter = 1; while (n.to_str_radix(10).chars().count() > 1) { n = factorize(n); println!("n: {:?}", n); counter += 1; } return counter; } fn factorize(input: BigUint) -> BigUint { let string = input.to_str_radix(10); let numbers: Vec = string.chars().map(|x| x as u8 - 48).collect(); numbers.into_iter().product::() }