Yes, of course it was x.  !
M

Sent from my iPad

> On 5 Feb 2021, at 02:17, chris burke <cbu...@jsoftware.com> wrote:
> 
> Thanks, fixed now.
> 
> The code dates from the time when x. was the left argument.
> 
> On Thu, Feb 4, 2021 at 4:00 PM 'Michael Day' via Programming
> <programm...@jsoftware.com> wrote:
>> 
>> 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
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to