Skip to content

Instantly share code, notes, and snippets.

@xtetsuji
Created January 18, 2017 16:20
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 xtetsuji/c086f34b89e3db7b333bee967b50a945 to your computer and use it in GitHub Desktop.
Save xtetsuji/c086f34b89e3db7b333bee967b50a945 to your computer and use it in GitHub Desktop.
How many kind numbers 9*9 multiplation table has.
#!/usr/bin/perl
use strict;
use warnings;
my %seen;
for my $i (1..9) {
for my $j (1..9) {
$seen{$i * $j}++;
}
}
my @seen = keys %seen;
print "9*9 tables has " . @seen . " kind numbers\n";
__END__
$ perl 99seen.pl
9*9 tables has 36 kind numbers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment