Skip to content

Instantly share code, notes, and snippets.

@Altreus
Created March 18, 2014 17:12
Show Gist options
  • Save Altreus/9624604 to your computer and use it in GitHub Desktop.
Save Altreus/9624604 to your computer and use it in GitHub Desktop.
use 5.010;
use strict;
my $i = 0;
my %fb = qw (3 fizz 5 buzz 7 wolf);
my %h = map { (2 ** $i++), $_ } qw (fizz buzz wolf);
for my $x (1..105) {
my $num = 0;
my $j = 0;
for my $fb (sort keys %fb) {
$num |= !($x % $fb) << $j++;
}
say $num ? @h{ grep { $_ & $num } sort keys %h } : $x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment