Thread Project Euler (56 answers)
Opened by Ronnie at 2007-12-15 12:19

Gast Gast
 2008-12-31 14:52
#104314 #104314
Ich habe es auch so verstanden wie Ronnie, die Lösung war dann auch richtig:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
    my $max = 0;
while ( $digits ) { # iterate through $digits
my $next = substr( $digits, 0, $nod ); # get next digits

my @fac = split( '', $next ); # get factors
my $cur = 1;
$cur *= $_ for ( @fac ); # multiply
$cur > $max and $max = $cur; # set as maximum if needed

substr( $digits, 0, 1, '' ); # delete 1st digit
} # while

Wobei $digits diese lange Zahl ist und $nod die Anzahl an aufeinander folgenden Zahlen.

MfG Horst

View full thread Project Euler