hello peepz...
does anyone knows what the formula on getting the prime number in the c code??
hello peepz...
does anyone knows what the formula on getting the prime number in the c code??
Just loop through each number below it (below half of it, really) modding by that number to make sure there is a remainder in all of them. There are more efficient algos to do it, but unless your planning on finding the largest prime numbers in existence, I wouldn't worry about it.
Last edited by SlyMaelstrom; 09-13-2006 at 01:57 AM.
Sent from my iPadŽ
what if the input is to numbers then you have to output the prime numbers from first input until the 2nd input???
Show some code... we're not here to give you answers...
I'll say this... there is a specific kind of loop where you can specify lower bounds and upper bounds right in the statement.
Sent from my iPadŽ
You can also look into Fermat's little theorem if you want to get a solid boost in efficiency.
Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction
Google it!Originally Posted by teves16