Skip to content

Instantly share code, notes, and snippets.

@solson
Forked from anonymous/playground.rs
Created December 17, 2017 06:11
Show Gist options
  • Select an option

  • Save solson/8aa24b4e3dace7a1c931c7cd770c5b11 to your computer and use it in GitHub Desktop.

Select an option

Save solson/8aa24b4e3dace7a1c931c7cd770c5b11 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
const _INPUT: usize = 3;
const INPUT: usize = 369;
fn main() {
let mut after_0 = None;
let mut pos = 0;
let mut buffer_len = 1;
for new_val in 1..50000001 {
pos = (pos + INPUT) % buffer_len;
if pos == 0 {
after_0 = Some(new_val);
}
buffer_len += 1;
pos += 1;
}
println!("{}", after_0.unwrap());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment