comp.lang.ada
 help / color / mirror / Atom feed
From: "Mr. Man-wai Chang" <toylet.toylet@gmail.com>
Subject: Re: language defined list of prime numbers
Date: Sun, 10 Dec 2017 01:23:00 +0800
Date: 2017-12-10T01:23:00+08:00	[thread overview]
Message-ID: <p0h65i$v3r$1@toylet.eternal-september.org> (raw)
In-Reply-To: <p0h5jq$qm9$1@dont-email.me>

On 10/12/2017 1:13 AM, Jeffrey R. Carter wrote:
> On 12/09/2017 06:05 PM, Mehdi Saada wrote:
>> I might not get what you mean. I just supposed it should mandatory to
>> provide a list of all prime numbers between 0 and let's say, 5000 at
>> least, in the form of a function returning the next prime after N.
>> I have to write a function to simplify fractions, and I very doubt the
>> teacher wants us at this point, to implement an whole algorithm to
>> find prime numbers (up to the squared root), just for that.
>
> To simplify fractions, all you need is the GCD algorithm.
>

How about using the algorithm to calculate all prime numbers then store 
them in a table? That should solve the efficiency problem. How about 
pre-loading the table into memory? :)

-- 
   @~@   Remain silent! Drink, Blink, Stretch! Live long and prosper!!
  / v \  Simplicity is Beauty!
/( _ )\ May the Force and farces be with you!
   ^ ^   (x86_64 Ubuntu 9.10)  Linux 2.6.39.3
不借貸! 不詐騙! 不援交! 不打交! 不打劫! 不自殺! 請考慮綜援 (CSSA):
http://www.swd.gov.hk/tc/index/site_pubsvc/page_socsecu/sub_addressesa

  reply	other threads:[~2017-12-09 17:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-09 15:57 language defined list of prime numbers Mehdi Saada
2017-12-09 16:18 ` Mr. Man-wai Chang
2017-12-09 17:05   ` Mehdi Saada
2017-12-09 17:13     ` Jeffrey R. Carter
2017-12-09 17:23       ` Mr. Man-wai Chang [this message]
2017-12-09 19:17         ` Mehdi Saada
2017-12-13 10:41           ` Mr. Man-wai Chang
2017-12-15  5:58             ` Dirk Heinrichs
2017-12-15 11:41               ` Mr. Man-wai Chang
2017-12-15 15:32                 ` Dirk Heinrichs
2017-12-09 16:43 ` Dennis Lee Bieber
2017-12-09 19:09 ` Mehdi Saada
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox