Dear Pearl Monks, I'm back twice in 2 days. I managed to get a program to work which pleases me no end, but now I face some issue relating to large integers (I think). The following code breaks down very soon after it starts. It had run happily all day long with small input $beg and $end amounts. The integers being handled are about 10^20, so I would have thought big float would be happy.
#!/usr/bin/env perl use warnings; use strict; use Math::BigFloat lib=>"GMP"; use Math::Prime::Util qw/:all/; use feature ':5.10'; use File::Slurp; my @crt = (68083089690,131417981310,36415643880,51194848320,1061578864 +50,30083217780,154569039240,55922110860,18269362650,12688113900,10860 +8348310,2163950250,195808561410,89629478400,35610139950,164950347870, +104015130450,198396537570,4751926410,91952139510,187872373920,1822911 +25170,144638376960,149365639500,45991448580,94402601370,142813754160, +69142506510,132477398130,164144843940); my $beg = shift || 91960283; my $end = shift || 300000000; my $fact = 2*3*5*7*11*13*17*19*23*29*31; my $target = 650; foreach my $i ($beg .. $end) { foreach my $a (@crt) { my $num = $fact*$i+$a; my $start = prev_prime($num); my $end = next_prime($num); my $gap = $end - $start; if ($gap> $target) { say $i, " ", $a, " ", $gap," ",$gap/log($num); } } }
In reply to Odd error message by robert44444uk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |