working on Euler problem 3
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
here is my Perl code just try to get all the factors first but it got segmentation fault, my Perl age is just about 2 month, could not figure out why. Segmentation fault 11 when I run it.
#!/usr/bin/perl
use warnings;
use strict;
my $number = 600851475143;
my @factors = grep {$number % $_ == 0} (1..$number);
print @factors;
Run it again with sudo, no more segmentation fault but nothing printed out.
(1..$number)will generate an 2T array. Are you using a 64-bit OS?