blob: e98223d10b2544804d58e544170395c698367cb5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/usr/bin/env perl
use strict;
use warnings;
# Compute distinct digits of the given number
sub distinct {
my $n = shift;
my %uniq; # Poor man's set
$uniq{$_} = 1 foreach split(//, $n);
return keys %uniq;
}
my $n = 0;
$n++ while distinct($n**2) != 5;
print "$n ($n**2 = ", $n**2, ")\n";
|