I am trying to implement Fermat Attack in maple but it is giving me an error stating that Error,(unexpected. Super beginner with Maple so if anyone who does have some experience could help, it would be much appreciated.
Also, I am trying to factor an integer that is 125 digits long. Does anyone know any efficient algorithm in Maple or any other program that can handle and factor such a large integers?
FermatAtttack:=proc(n::And(posint,odd), maxnumsteps::posint:=10^7,(numsteps::truefalse:=false))
local x, k, r, i, y:
x:=isqrt(n);
if x^2 < n then
x:= x+1
end if;
k:=2*x+1;
r:=x^2-n;
for i to maxnumsteps while not issqr(r) do
r:=r+k;
k:=k+2
end do;
if issqr(r) then
x:=(k-1)/2;
y:=isqrt(r)
else
error "%1 could not facot in %2 iteratioons", n, maxnumsteps
end if;
if not numsteps then
x-y, x+y
else
x-y, x+y, i
end if;
end proc:
The error message is a simple syntax error. Your first line is probably supposed to be
Maple uses the command "ifactor" to factor integers.