Hello mgatto, and welcome to the Monastery!
From the information given, I cannot reproduce your problem:
#! perl use strict; use warnings; use bigint; use List::Util qw( max ); use Data::Dumper; my @result = prime_factors(600_851_475_143); #print Dumper \@result; print max @result; sub prime_factors { my ($number) = @_; my $divisor = 2; my @factors; while ($number > 1) { if (($number % $divisor) == 0) { push @factors, $divisor; $number /= $divisor; } elsif ($divisor == 2) { ++$divisor; } else { $divisor += 2; } } return @factors; }
Output:
12:58 >perl 609_SoPW.pl 6857 13:00 >
However, the problem you are seeing may be related to the problem I experienced recently with bignum and the range operator: see Strange interaction of bigint and foreach.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: List::Util can't find max in array of BigInts
by Athanasius
in thread List::Utils can't find max in array of BigInts
by mgatto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |