in reply to
Project Euler (a series of challenging mathematical/computer programming problems)

i'm pretty sure my answer for 112 is correct, but apparently it's not. anybody see anything wrong with this? it works fine for the two examples (.5->538, .9->21780).

`my $max = .99;
my $bouncy = 0;
for (my $n=1; ; $n++)
{
my ($inc, $dec) = (0, 0);
my @d = split //, $n;
for (my $i=0; $i<@d-1; $i++)
{
if ($d[$i] < $d[$i+1]) { $inc++ }
elsif ($d[$i] > $d[$i+1]) { $dec++ }
}
$bouncy++ if $inc and $dec;
next if $max > $bouncy/$n;
printf "n=%d: %%%f\n", $n, $bouncy/$n;
last;
}
`