This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn solve(max:u32, terms:usize) -> usize { | |
(1..max) | |
.filter(|&i| { | |
let mut v = Vec::with_capacity(terms); | |
let mut start = i; | |
let mut j = 0; | |
while !v.contains(&start) { | |
v.push(start); | |
start = digit_factorial_sum(start); | |
j += 1 | |
} | |
return j == terms | |
}) | |
.count() | |
} | |
solve(1000000, 60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment