From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e3ba37c5a979fdcb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!news.glorb.com!newspeer1.se.telia.net!se.telia.net!masternews.telia.net.!newsb.telia.net.POSTED!not-for-mail From: =?ISO-8859-1?Q?Bj=F6rn_Persson?= User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: invalid parameter list References: <1140218028.145204.141420@z14g2000cwz.googlegroups.com> <1140249851.389233.273980@g47g2000cwa.googlegroups.com> In-Reply-To: <1140249851.389233.273980@g47g2000cwa.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Date: Sat, 18 Feb 2006 14:34:54 GMT NNTP-Posting-Host: 83.250.106.90 X-Complaints-To: abuse@telia.com X-Trace: newsb.telia.net 1140273294 83.250.106.90 (Sat, 18 Feb 2006 15:34:54 CET) NNTP-Posting-Date: Sat, 18 Feb 2006 15:34:54 CET Organization: Telia Internet Xref: g2news1.google.com comp.lang.ada:2955 Date: 2006-02-18T14:34:54+00:00 List-Id: isaac2004 wrote: > the output for this is writing the chains to a txt file and then > outputting them on the screen. my loop would look something like this > > for N Start.. Stop loop > > Sociable_Chain ( N, Max) ; > > end loop; > > that is how am i thinking will this be buggy or what You can do the writing either inside Sociable_Chain or in another procedure. If you'll do it in another procedure you'll need to get the whole array out of Sociable_Chain and pass it to that other procedure. > function Sum_Of_Divisors ( > N : Integer) > return Integer is > C : Integer; > Sum : Integer; > > begin > Sum := 1; > C:=2; > while C**2 <= N loop --Number > > if N mod C = 0 then > if C * 2 = N then > Sum := Sum + C; > else > Sum := Sum + C + N / C; > end if; > end if; > C := C + 1 ; > end loop; > return Sum ; > > end Sum_Of_Divisors; If I call this function with N=9 it will return 7. Is that really right? Why Integer? What should the function return if N is -38? (What are the proper divisors of 1 or 0 anyway?) -- Bj�rn Persson PGP key A88682FD omb jor ers @sv ge. r o.b n.p son eri nu