Having a look at the scripts in ~addons/math/misc, I've just noticed a
slip in
fermat.ijs - I doubt if it's used much, though, which is probably why
it hasn't
been reported. Its fellow script, pollard.ijs, has a greatly superior
factoring
algorithm or two.
The optional left argument of the verb fermatfactor specifies the maximum
number of iterations, but on starting the dyad, x is immediately
replaced by
the ceiling of the square root of y.
These few lines will cure the problem, with a variable name to taste;
I'm using
X here.
fermatfactor=: 3 : 0
10000 fermatfactor y
:
X=. >.@%: x: y NB. perhaps call it rty for sqrt y
u=. >:+:X
v=. 1
r=. (*:X)-y
NB. the rest is ok
The problem is there in J902 as well as J903 beta, and presumably in
earlier versions too.
Cheers,
Mike
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm