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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c9d5fc258548b22a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!news2.glorb.com!transit3.readnews.com!textspool1.readnews.com!news-out.readnews.com!postnews3.readnews.com!not-for-mail Date: Wed, 09 Feb 2011 15:00:28 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <4d5031fe$0$6765$9b4e6d93@newsspool3.arcor-online.net> <1f229967-d3cf-42b6-8087-c97ee08652f3@i40g2000yqh.googlegroups.com> <4d51169e$0$7657$9b4e6d93@newsspool1.arcor-online.net> <4d51905c$0$19486$882e7ee2@usenet-news.net> <36212a7b-deab-45d9-ac45-aa29cd90c7bc@o18g2000prh.googlegroups.com> <4d51a7bb$0$19486$882e7ee2@usenet-news.net> <4d52b489$0$19486$882e7ee2@usenet-news.net> <9a8njlwvey1p.1a96yvvgdf6yu.dlg@40tude.net> <4d52c5e5$0$19486$882e7ee2@usenet-news.net> <4d52d7d9$0$18057$882e7ee2@usenet-news.net> <1jf3s95v7yrkk.1m7rl9zt042py$.dlg@40tude.net> <4d52e704$0$18057$882e7ee2@usenet-news.net> <271ad249-94dd-43d9-b550-59bd8e2208fc@y12g2000prf.googlegroups.com> In-Reply-To: <271ad249-94dd-43d9-b550-59bd8e2208fc@y12g2000prf.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4d52f25d$0$18057$882e7ee2@usenet-news.net> NNTP-Posting-Host: 320ba6a4.usenet-news.net X-Trace: DXC=3hNb<3n^CjN0gU[gLZQGQG^oXGM_6\KV@mX0AG3X_jUO<^JMhOhjP4NVjKk:Lk^BNAcR12TN^Bg7NCKIHCW3N^VDOiaDcmXlf@E X-Complaints-To: abuse@usenet-news.net Xref: g2news2.google.com comp.lang.ada:18112 Date: 2011-02-09T15:00:28-05:00 List-Id: On 2/9/2011 2:41 PM, Shark8 wrote: > Yes. It takes a bit of doing but check out the proofs of recursive > & iterative implementations of functions being identical. The > methods used in the implementations are *NOT* identical, but > the methods themselves are identical in that for ANY input > given they produce the EXACT SAME output. Can I play too? I'll write my routine in C, but the translation to Ada should be readily apparent: unsigned Exponent(unsigned base, unsigned exp) { if (exp == 0) return 1; if (base == 0) return 0; while (true) { unsigned guess = random(); unsigned g = guess; unsigned i = 0; while (g % base == 0 && i < exp) { g = g / base; i = i + 1; } if (g == 1 && i == exp) return guess; } } Is it OK if I replace your Exponent method with my implementation?