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 knowsome 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 byonly 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 findingout 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 underlinedthe 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 HunkinSent: 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@xxxxxxxxxxxxxxxVisit 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