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!news4.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: Range error (was: Ada.Text_IO.Create) References: <1140297548.116832.212770@g43g2000cwa.googlegroups.com> <57OJf.45346$d5.201767@newsb.telia.net> <1140415791.303850.38080@z14g2000cwz.googlegroups.com> <3stiv1l39144oscbs5he2v6h5uvfmli03q@4ax.com> <1140560159.318265.105160@g47g2000cwa.googlegroups.com> In-Reply-To: <1140560159.318265.105160@g47g2000cwa.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Date: Wed, 22 Feb 2006 07:45:32 GMT NNTP-Posting-Host: 83.250.106.90 X-Complaints-To: abuse@telia.com X-Trace: newsb.telia.net 1140594332 83.250.106.90 (Wed, 22 Feb 2006 08:45:32 CET) NNTP-Posting-Date: Wed, 22 Feb 2006 08:45:32 CET Organization: Telia Internet Xref: g2news1.google.com comp.lang.ada:3065 Date: 2006-02-22T07:45:32+00:00 List-Id: isaac2004 wrote: > i only have one more question. when i run my code for a length of 30 it > hits a range error, any help on how on fix it OK, it turns out that you need far bigger numbers than the type Integer (or Natural for that matter) can handle. With the inputs 12000, 15000 and 30, the program will encounter numbers at least as big as 13606250238463924. You will have to define an integer type of your own, with a large enough range, and use it for all those variables that will handle sums of divisors; not for the chain lengths of course. This also means that you can't read or print these numbers with Ada.Integer_Text_IO. You will have to make your own instance of Ada.Text_IO.Integer_IO. Ada.Integer_Text_IO is a predefined instance of Ada.Text_IO.Integer_IO, instantiated with Integer. Now you'll have to instantiate Ada.Text_IO.Integer_IO with your own type instead. -- Bj�rn Persson PGP key A88682FD omb jor ers @sv ge. r o.b n.p son eri nu