Skip to content

Instantly share code, notes, and snippets.

@jkramer
Last active January 6, 2016 11:05
Show Gist options
  • Select an option

  • Save jkramer/1c993b5bee59b1ccfc56 to your computer and use it in GitHub Desktop.

Select an option

Save jkramer/1c993b5bee59b1ccfc56 to your computer and use it in GitHub Desktop.
A program that prints the number 6210001000 really fast.
#!/usr/bin/env perl6
my Int @digits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
loop {
my $changed = False;
for [0..9] -> $digit {
my $count = @digits.grep($digit).elems;
if @digits[$digit] != $count {
$changed ||= True;
@digits[$digit] = $count;
}
}
last unless $changed;
}
say @digits;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment