RE: prime numbers question

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 16 Aug 2009 09:07:07 -0400

*smile*, this is actually a very minimal optimization ... There is a far
better, and just as easy, optimization, but I was trying to specifically not
say it until we receive some responses, per hapse some attempts at code, and
so on.

*smile*
 
Take care,
Sina

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Chris Hofstader
Sent: Sunday, August 16, 2009 8:55 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: prime numbers question

One optimization to Sina's description is that you can automatically  
eliminate all even numbers as all are divisible by 2.
On Aug 16, 2009, at 8:46 AM, Sina Bahram wrote:

> Start by defining what a prime number is ... I'm going to assume you  
> know
> some of this, but I won't give the full answer here.
>
> Very rough, non-mathematical definition:
>
> A prime number is any number greater than 1, which is evenly  
> divisible by
> only itself and 1.
>
> The first  few are: 2, 3, 5, 7, 11, 13, 17, 19, 23, and so on.
>
> So if I was a computer, and I'm given a number, I have to figure out  
> if it
> is evenly divisible by only itself and one.  How would I go about  
> finding
> out what a number is evenly divisible by?
>
> Hint:
>
> Evenly divisible is another way of saying that when you divide a  
> number by a
> divisor, the remainder is 0.  If this was in print, I would have  
> underlined
> the word remainder.
>
> Hope this puts you on the right track?
>
> Take care,
> Sina
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Marvin  
> Hunkin
> Sent: Sunday, August 16, 2009 8:14 AM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: prime numbers question
>
> hi.
> have to do a assignment in cz++.
> where you enter a number.
> then it will spit out if it is a prime number or a composite number.
> any ideas how i code this.
> cheers Marvin.
> E-Mail: startrekcafe@xxxxxxxxx
> Msn: startrekcafe@xxxxxxx
> Skype: startrekcafe
> to subscribe to the Jaws Australia group send a blank message to
> JawsOz-subscribe@xxxxxxxxxxxxxxx
> Visit my Jaws Australia Group at http://groups.yahoo.com/groups/ 
> JawsOz/
>
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: