blob: 403cf91c116fb6e201188b5d952480ad9f805631 (
plain)
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
28
29
|
use strict;
use warnings;
use Data::Dumper;
my $low_bound = 353096;
my $upper_bound = 843212;
my $count = 0;
for (my $number = $low_bound; $number < $upper_bound; $number++) {
my @nums = split //, $number;
my @cmp = sort {$a <=> $b} @nums;
if (@nums == @cmp and join ("\0", @nums) eq join ("\0", @cmp)) {
my %digits = ();
foreach (@nums) {
$digits{$_}++;
}
foreach my $reps (values %digits) {
if ($reps == 2) {
print "$number\n";
$count++;
last;
}
}
}
}
print ">$count\n";
|