source code for "files/pe/pe_052.pl"
return to portfolio
- #!/usr/bin/perl
- use strict;
- use warnings;
- # do they have the same digits?
- sub has_same_digits {
- my ($first) = join('', sort split //, shift);
- for (@_) {
- my ($test) = join('', sort split //, $_);
- return 0 unless $first eq $test;
- }
- return 1;
- }
- for (my $k=1; 1; $k++) {
- if (has_same_digits($k, 2*$k, 3*$k, 4*$k, 5*$k, 6*$k)) {
- print $k;
- last;
- }
- }