|
|
@ -1,10 +1,17 @@
|
|
|
|
use failure::*;
|
|
|
|
use failure::*;
|
|
|
|
|
|
|
|
|
|
|
|
pub fn solve(_: &str) -> Result<String, Error> {
|
|
|
|
pub fn solve(_: &str) -> Result<String, Error> {
|
|
|
|
let a = Generator{value: 679, factor: 16807};
|
|
|
|
let a = Generator {
|
|
|
|
let b = Generator{value: 771, factor: 48271};
|
|
|
|
value: 679,
|
|
|
|
|
|
|
|
factor: 16807,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
let b = Generator {
|
|
|
|
|
|
|
|
value: 771,
|
|
|
|
|
|
|
|
factor: 48271,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let answer = a.filter(|a| a % 4 == 0).zip(b.filter(|b| b % 8 == 0))
|
|
|
|
let answer = a.filter(|a| a % 4 == 0)
|
|
|
|
|
|
|
|
.zip(b.filter(|b| b % 8 == 0))
|
|
|
|
.take(5_000_000)
|
|
|
|
.take(5_000_000)
|
|
|
|
.filter(|&(a, b)| a & 0b1111111111111111 == b & 0b1111111111111111)
|
|
|
|
.filter(|&(a, b)| a & 0b1111111111111111 == b & 0b1111111111111111)
|
|
|
|
.count();
|
|
|
|
.count();
|
|
|
@ -25,4 +32,3 @@ impl Iterator for Generator {
|
|
|
|
Some(self.value)
|
|
|
|
Some(self.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|