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> <1140297548.116832.212770@g43g2000cwa.googlegroups.com> In-Reply-To: <1140297548.116832.212770@g43g2000cwa.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <57OJf.45346$d5.201767@newsb.telia.net> Date: Sat, 18 Feb 2006 23:31:13 GMT NNTP-Posting-Host: 83.250.106.90 X-Complaints-To: abuse@telia.com X-Trace: newsb.telia.net 1140305473 83.250.106.90 (Sun, 19 Feb 2006 00:31:13 CET) NNTP-Posting-Date: Sun, 19 Feb 2006 00:31:13 CET Organization: Telia Internet Xref: g2news1.google.com comp.lang.ada:2968 Date: 2006-02-18T23:31:13+00:00 List-Id: isaac2004 wrote: > does that loop look correct though, Yes, except that the keyword "in" is missing. > also how do i write the a chain to a txt file? Declare a variable of the type Ada.Text_IO.File_Type, open the file with Ada.Text_IO.Create and write each number with Ada.Integer_Text_IO.Put. >> 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?) > > should i use natural then instead of integer, According to Wikipedia (http://en.wikipedia.org/wiki/Divisor), only positive divisors can be proper divisors, so the sum of a set of proper divisors will always be positive. It is therefore pointless to search for sociable chains among the negative intgers, so yes, I think you should use Natural. > there are no divisors of 1 or 0, Then shouldn't the sum of their proper divisors be 0? Your function will return 1. > the divisors of 9 is 7 ( 1+ 3+3) The divisors of 9 are -9, -3, -1, 1, 3 and 9. The _proper_ divisors are 1 and 3. 1+3=4. -- Bj�rn Persson PGP key A88682FD omb jor ers @sv ge. r o.b n.p son eri nu