blob: 82c127f1c8a7ca98e4580e3ede608dbafa782c1c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/usr/bin/env perl
use strict;
use warnings;
use 5.016;
chomp(my $length = <>);
my @elements = 1..$length;
say 2 ** $length;
for my $i (0..(2 ** $length - 1)) {
my @included = split '', sprintf("%0${length}b", $i);
say '{'
. join(', ', map { $elements[$_] } grep { $included[$_] } 0..$length)
. '}';
}
|