sub is_power_of_2 { my $number = shift; sprintf('%b',$number) =~ /^10*$/ ? 1 : 0; }