Project Euler Problem 38
I wrote a bunch of these but never posted them up, so I'm just uploading them in bulk now. Not much to say about them at this point.
- #!/usr/bin/perl -w
- sub is_pandigital {
- my $seen;
- foreach my $d (@digits) {
- $seen->{$d} = 1;
- }
- }
- sub p38 {
- my $len = 0;
- my $max = 0;
- for(my $k = 100000; $k > 0; $k--) {
- my $prod ='';
- my $n = 1;
- my $p = $n*$k;
- $prod .= "$p";
- if(is_pandigital($prod)) {
- if($prod > $max) {
- $max = $prod;
- }
- }
- }
- $n++;
- }
- }
- }
- p38();