* language defined list of prime numbers
@ 2017-12-09 15:57 Mehdi Saada
2017-12-09 16:18 ` Mr. Man-wai Chang
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Mehdi Saada @ 2017-12-09 15:57 UTC (permalink / raw)
Does the norm compel compilers to provide a descent list of prime numbers ? I can't find "prime" in the RM.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: language defined list of prime numbers
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 16:43 ` Dennis Lee Bieber
2017-12-09 19:09 ` Mehdi Saada
2 siblings, 1 reply; 12+ messages in thread
From: Mr. Man-wai Chang @ 2017-12-09 16:18 UTC (permalink / raw)
On 9/12/2017 11:57 PM, Mehdi Saada wrote:
> Does the norm compel compilers to provide a descent list of prime numbers ? I can't find "prime" in the RM.
>
I think prime numbers are not a number series. You have to specify the
range for a list of prime numbers, don't you?
--
@~@ 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: language defined list of prime numbers
2017-12-09 16:18 ` Mr. Man-wai Chang
@ 2017-12-09 17:05 ` Mehdi Saada
2017-12-09 17:13 ` Jeffrey R. Carter
0 siblings, 1 reply; 12+ messages in thread
From: Mehdi Saada @ 2017-12-09 17:05 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: language defined list of prime numbers
2017-12-09 17:05 ` Mehdi Saada
@ 2017-12-09 17:13 ` Jeffrey R. Carter
2017-12-09 17:23 ` Mr. Man-wai Chang
0 siblings, 1 reply; 12+ messages in thread
From: Jeffrey R. Carter @ 2017-12-09 17:13 UTC (permalink / raw)
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.
--
Jeff Carter
"Ada has made you lazy and careless. You can write programs in C that
are just as safe by the simple application of super-human diligence."
E. Robert Tisdale
72
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: language defined list of prime numbers
2017-12-09 17:13 ` Jeffrey R. Carter
@ 2017-12-09 17:23 ` Mr. Man-wai Chang
2017-12-09 19:17 ` Mehdi Saada
0 siblings, 1 reply; 12+ messages in thread
From: Mr. Man-wai Chang @ 2017-12-09 17:23 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: language defined list of prime numbers
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 16:43 ` Dennis Lee Bieber
2017-12-09 19:09 ` Mehdi Saada
2 siblings, 0 replies; 12+ messages in thread
From: Dennis Lee Bieber @ 2017-12-09 16:43 UTC (permalink / raw)
On Sat, 9 Dec 2017 07:57:52 -0800 (PST), Mehdi Saada <00120260a@gmail.com>
declaimed the following:
>Does the norm compel compilers to provide a descent list of prime numbers ? I can't find "prime" in the RM.
"Prime number" is a concept just like "odd" and "even". No compiler
that I know of provides such as an inherent data type -- they must be
determined at run-time via an algorithm you have to provide. For
"odd"/"even" that algorithm is rather simple, using a simple modulo 2
operation. For "prime number" the algorithm becomes time consuming unless
one caches results for future use -- Google "Sieve of Eratosthenes" -- the
larger the prime number, the more time it takes to compute it.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: language defined list of prime numbers
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 16:43 ` Dennis Lee Bieber
@ 2017-12-09 19:09 ` Mehdi Saada
2 siblings, 0 replies; 12+ messages in thread
From: Mehdi Saada @ 2017-12-09 19:09 UTC (permalink / raw)
okay, thanks. It was probably in the part of the course I can't do because gtkada failed >_>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-12-15 15:32 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox