Front page | perl.ppt |
Postings from April 2014
From: Dave Nunn
April 19, 2014 06:44
Message ID: CAB6ToBg-+=83tm1V2o0955=_w8VzJL-ST08NpFf-GQbQR8becw@mail.gmail.com
Not sure anyone is tracking this, but the factor program at:
does indeed have a bug. Try:
and it will report this as prime, though 59*61 == 3599.
The bug is presumably in the line:
$max-- if $max %2; # Make the max odd
as this does NOT force $max to be odd, but rather even.
Not sure if the preferred rectification is:
$max++ unless $max %2;
$max-- unless $max %2;
though either works for the specific case of 3599.
-- David S. Nunn, PhD