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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.ada Subject: Re: If not Ada, what else... Date: Wed, 29 Jul 2015 10:47:45 -0700 Organization: A noiseless patient Spider Message-ID: <87bneuony6.fsf@jester.gateway.sonic.net> References: <87y4io63jy.fsf@jester.gateway.sonic.net> <7a29d3e9-d1bd-4f4a-b1a6-14d3e1a83a4d@googlegroups.com> <87mvz36fen.fsf@jester.gateway.sonic.net> <2215b44f-8a89-47c6-a4c4-52b74d2dac45@googlegroups.com> <9e492c82-868d-43d3-a18a-38274400e337@googlegroups.com> <40184feb-4053-4ac3-8eaa-c3bd9cd8a77c@googlegroups.com> <10272577-945f-4682-85bc-8ad47f3653ae@googlegroups.com> <87si8i81k2.fsf@atmarama.net> <8076cbd0-2655-4c98-b70e-cb5f0c32e4ba@googlegroups.com> <5e6cb30b-5f8c-4fed-969e-3941315ecba0@googlegroups.com> <87si87nf8k.fsf@jester.gateway.sonic.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="d4217d68945dedf510265c644f2a7daa"; logging-data="18570"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18mzeERwTk9/r/fVlA9KpcM" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:xXmlP0E/d7XyTjrPZLs6wqnl18w= sha1:j/RpE9OggxuiRYgCF8TjV0VZVpE= Xref: news.eternal-september.org comp.lang.ada:27135 Date: 2015-07-29T10:47:45-07:00 List-Id: Stefan.Lucks@uni-weimar.de writes: > http://rosettacode.org/wiki/Hamming_numbers#Ada That is not a reasonable solution IMHO. It counts upwards 1,2,3... testing each number for the testing property. Computers now are fast enough that this can run through a 32-bit count without taking all day, so it is able to find the 1691th number which is around 2e9. But the 10000th number is around 3e17 and the Haskell program finds it basically instantly. The documentation for the Ada program mentions it would have to use a bignum library to find the millionth Hamming number, which overlooks the issue that the number is around 5e83 and counting that far would take essentially forever. The Haskell program gets it in a few seconds. You could implement the Haskell algorithm in Ada with a page or two of code but it would be rather tedious.