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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.