--* From SMWATT%WATSON.vnet.ibm.com@yktvmv.watson.ibm.com  Mon Apr  4 12:20:23 1994
--* Received: from yktvmv.watson.ibm.com by leonardo.watson.ibm.com (AIX 3.2/UCB 5.64/920123)
--*           id AA19623; Mon, 4 Apr 1994 12:20:23 -0500
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 4367; Mon, 04 Apr 94 13:19:56 EDT
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.SMWATT.NOTE.VAGENT2.7921.Apr.04.13:19:55.-0400>
--*           for asbugs@watson; Mon, 04 Apr 94 13:19:56 -0400
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id 7915; Mon, 4 Apr 1994 13:19:55 EDT
--* Received: from spadserv.watson.ibm.com by yktvmv.watson.ibm.com
--*    (IBM VM SMTP V2R3) with TCP; Mon, 04 Apr 94 13:19:54 EDT
--* Received: by spadserv.watson.ibm.com (AIX 3.2/UCB 5.64/900524)
--*           id AA14127; Mon, 4 Apr 1994 13:21:01 -0400
--* Date: Mon, 4 Apr 1994 13:21:01 -0400
--* From: smwatt@spadserv.watson.ibm.com (Stephen Watt)
--* X-External-Networks: yes
--* Message-Id: <9404041721.AA14127@spadserv.watson.ibm.com>
--* To: asbugs@watson.ibm.com
--* Subject: [3] Incorrect error: "foo.as", line 30: (Error) No meaning for identifier `k' in this context. [foo.as][v34.6]

--@ Fixed  by:  SSD   Tue Apr 18 10:09:05 EDT 1995 
--@ Tested by:  none 
--@ Summary:    No longer gives type inference errors. Probably fixed by updates to scope binder handling of implicit locals. 
--PI: this is a variant of bug426 (look at file bug426.1.as)

#include "aslib"
#library EcFactLib "ecfact.aso"

import from EcFactLib;
import from EllipticCurveFactorization;
import from Integer;
import from Segment Integer;

trynum(n: Integer, i: Integer): Integer == {
	mult := lcm(1..i);
	print("...with lcm(1..")(i)(") = ")(mult)();
	f := LenstraEllipticMethod(n, mult);
	print("The result is ")(f)();
	f
}

n1 := 2^(2^5) + 1;
n2 := 132686104398972053177608575506090561429353935989033525802891469459697;

print("Trying the number ")(n1)(" ------------------------ ")();

for i in 1.. repeat {
	k := trynum(n1, i);
	if k ~= 1 then break
}

print("Trying the number ")(n2)(" ------------------------ ")();
for i in 1.. repeat {
	k := trynum(n2, i);
	if k ~= 1 then break
}
 
