Last active
April 10, 2019 18:24
-
-
Save tony-o/0999977b7c5fa383733ac933031c988b to your computer and use it in GitHub Desktop.
This file contains 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
my @ARGV = do { sub eval { chomp &EVAL(@_) }; eval( ("0" and q|@*ARGS| or q|@ARGV|) ) }; | |
for (1..@ARGV[0]) { | |
my $i = $_; | |
while ($i != 1) { | |
last if $i == 0; | |
if (sprintf("%d", $i / 2) == $i / 2) { | |
$i /= 2; | |
next; | |
} | |
if (sprintf("%d", $i / 3) == $i / 3) { | |
$i /= 3; | |
next; | |
} | |
if (sprintf("%d", $i / 5) == $i / 5) { | |
$i /= 5; | |
next; | |
} | |
last; | |
} | |
my $is = ''; | |
if ($i != 1) { | |
$is = ' not'; | |
} | |
printf "%s is%s hamming\n", $_, $is; | |
} | |
# vim:syntax=perl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment