Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!watdcsu!kishore2 From: kishore2@watdcsu.UUCP Newsgroups: comp.lang.pascal Subject: Re: Perfect number program Message-ID: <3936@watdcsu.waterloo.edu> Date: Thu, 8-Oct-87 16:33:16 EDT Article-I.D.: watdcsu.3936 Posted: Thu Oct 8 16:33:16 1987 Date-Received: Sun, 11-Oct-87 05:36:28 EDT References: <9662@brl-adm.ARPA> Reply-To: kishore2@watdcsu.waterloo.edu (Sherman Lang - Systems Design) Organization: U. of Waterloo, Ontario Lines: 15 In article <9662@brl-adm.ARPA> silva@tcgould.TN.CORNELL.EDU (Victor M. Silva) writes: >You can reduce your processing time in half by just having your inner >loop (FOR K=2 TO I...) only go to I/2 since anything larger cannot be >a divisor (ie. 2*(I+1) > I ). > -VMS- And you can reduce it further by going to trunc(sqrt(i)) instead. The other thing to do is to keep track of factors and to go backwards in your testing of k. -- ============================================================================= | Sherman Lang, Systems Design Engineering, University of Waterloo. | | "A screaming comes across the sky..." | =============================================================================