Improve divisible

Improve the divisible check by checking if the first digit of the number is smaller than or equal to the last digit
master
trivernis 5 years ago
parent 295f13d5bd
commit 009a12ee8b

@ -66,8 +66,8 @@ fn get_rotatable(tx: Sender<BigUint>, sen_time: Sender<bool>, start: u64, end: B
let first = *digits.first().unwrap() as u64; let first = *digits.first().unwrap() as u64;
let last = *digits.last().unwrap() as u64; let last = *digits.last().unwrap() as u64;
if (last < 5 || first == last) 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); digits.rotate_left(1);
let num_rotated = ubig_from_digits(digits); let num_rotated = ubig_from_digits(digits);
if (&num_rotated % &num).is_zero() { if (&num_rotated % &num).is_zero() {

Loading…
Cancel
Save