From 009a12ee8b595faa3e229c5e4bb9cd5e343d0776 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 9 Feb 2020 19:40:02 +0100 Subject: [PATCH] Improve divisible Improve the divisible check by checking if the first digit of the number is smaller than or equal to the last digit --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 523e877..52777ca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -66,8 +66,8 @@ fn get_rotatable(tx: Sender, sen_time: Sender, start: u64, end: B let first = *digits.first().unwrap() as u64; let last = *digits.last().unwrap() as u64; if (last < 5 || first == last) - && first >= last - && !(first % 2 == 0 && digits[1] % 2 != 0) { + && !(first % 2 == 0 && digits[1] % 2 != 0) + && (first == last || first/2 >= last) { digits.rotate_left(1); let num_rotated = ubig_from_digits(digits); if (&num_rotated % &num).is_zero() {