|< 1 2 >| | 15 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl -w
use strict;
my @zeichen = ("A".."C");
my $laenge = 3;
my $start = 0;
my $pos = $laenge;
my %string = {"1" => 'A', "2" => 'A', "3" => 'A'};
my $i=0;
while ($pos >= 1) {
for my $aktuell (@zeichen) {
$string{$laenge} = $aktuell;
print $string{$_} for (1..$laenge);
print "\n";
}
if ( $string{$pos} eq $zeichen[scalar(@zeichen)-1] ) {
$pos--;
$i=0;
$string{$laenge} = $zeichen[0];
}
$string{$pos} = $zeichen[$i];
$i++;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl
use strict;
use warnings;
use Math::Combinatorics;
my @zeichen = ('A'..'C');
my $count = 3;
my $combo = Math::Combinatorics->new( count => $count,
data => [(@zeichen) x $count]);
while(my @combo = $combo->next_combination){
print join(' ', @combo)."\n";
}
1
2
3
4
5
6
7
#!/usr/bin/env ruby -w
substitute = { '0' => 'A', '1' => 'B', '2' => 'C' }
(0 .. 26).each do | i |
puts i.to_s(3).rjust(3, '0').gsub(/./) { | k | substitute[k] }
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl
use strict;
use warnings;
use Math::Combinatorics;
my @zeichen = ('A'..'C');
my $count = 3;
my %permute;
my $combo = Math::Combinatorics->new( count => $count,
data => [(@zeichen) x $count]);
while(my @combo = $combo->next_combination){
$permute{join(' ', @combo)} = 1;
}
print join "\n",keys %permute;
|< 1 2 >| | 15 Einträge, 2 Seiten |