Skip to content

Instantly share code, notes, and snippets.

@jimjh
Created June 19, 2017 18:08
Show Gist options
  • Save jimjh/ca502c1e39e9ebaf47de169d288299d1 to your computer and use it in GitHub Desktop.
Save jimjh/ca502c1e39e9ebaf47de169d288299d1 to your computer and use it in GitHub Desktop.
Project Euler P112
pub fn search_bouncy() -> i32 {
//! procedural implementation
let mut n = 100;
let mut hit = 0.0;
let mut total = 100.0;
while hit / total < 0.99 {
n = n + 1;
if is_bouncy(n) {
hit = hit + 1.0;
}
total = total + 1.0;
}
n
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment