Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created February 22, 2017 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/fb635966fdafa9792b25a98e8e05d4f9 to your computer and use it in GitHub Desktop.
Save zoffixznet/fb635966fdafa9792b25a98e8e05d4f9 to your computer and use it in GitHub Desktop.
constant N = 10000;
constant DIV = 5;
constant CORES = 32;
constant batch = N div CORES;
(0, batch … N, N).rotor(2 => -1).flat.map({$^a^..$^b}).race(:batch).map(*.grep(* %% DIV).sum).sum.say;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment