Created
April 8, 2016 23:06
-
-
Save ColemanGariety/72e05a69bff96f5c783986df34206d47 to your computer and use it in GitHub Desktop.
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