1234567891011121314151617181920 |
- use std::env;
- fn main() {
- if env::args().len() != 2 {
- println!("Usage: {} divisor", env::args().nth(0).unwrap());
- return;
- }
- let divisor = env::args().nth(1).unwrap().parse::<u64>().ok().expect("Input is not a number");
- let mut num: u64 = 0;
- let mut s: u64 = 9;
- while s % divisor != 0 {
- num += 1;
- s = format!("{:b}", num).replace("1", "9").parse::<u64>().unwrap();
- }
- println!("Found: {}", s);
- }
|