Last active
January 6, 2016 11:05
-
-
Save jkramer/1c993b5bee59b1ccfc56 to your computer and use it in GitHub Desktop.
A program that prints the number 6210001000 really fast.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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