Skip to content

Instantly share code, notes, and snippets.

@perlpilot
Created July 20, 2017 13:37
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 perlpilot/434bea65c71dff73f2991909e4bf6dc6 to your computer and use it in GitHub Desktop.
Save perlpilot/434bea65c71dff73f2991909e4bf6dc6 to your computer and use it in GitHub Desktop.
#!/bin/bash
perl6 -e 'for 2..2000000 { put $_*$_*$_+1; }' | factor | \
perl6 -e '
my $s = 1;
for lines().kv -> $i, $l {
my $ln = $i + 1;
$s += $l.words[*-1]-1;
say $ln, "\t", $s if $ln %% 1_000;
}
say $s;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment