What would an easy way to detect odd prime numbers? Thanks!
What would an easy way to detect odd prime numbers? Thanks!
Do not make direct eye contact with me.
>What would an easy way to detect odd prime numbers?
http://www.gdargaud.net/Humor/OddPrime.html
But seriously, this may help us both (you since it has code, and me since I don't have to post any):
http://www.newdream.net/~sage/old/numbers/primeodd.htm
-Prelude
My best code is written with the delete key.
can anyone post any simple code, or explain the one Prelde gave me? Thanks!
Do not make direct eye contact with me.
Basaically, I'm just loking for a function to write out all primes below a specified number.
Here's some pseudocode to check primality:
Code:let the number to be checked be referred to as x for each odd number(n) greater than 1 and less than the square root of x if x is divisible by n then the number is not prime repeat if x wasn't divisble by any values of n, it's prime
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
I'm new w/c, how would i d this?
Do not make direct eye contact with me.
This would be your first line:Originally posted by Lurker
Cant think of anything that works...
#include <stdio.h>
Now come on, show a bit of effort. Post again when you have some code.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Ok, heres what i have so far, only displays odd numbers besides 1 right now:
Code:#include <stdio.h> int main(void) { register int i, n; for(i=0; i < 2001; i++) { if((i % 2 == 0) || (i == 2) || (i == 1)) continue; printf("%d ", i); } getchar(); return 0; }
Do not make direct eye contact with me.
>>only displays odd numbers besides 1 right now
How many even prime numbers do you know of?
Use XSquared's pseudo code to help build your C code.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
>>Use Prelude's pseudo code to help build your C code.
I se XSquared pseudo code
>>I se XSquared pseudo code
It's been a long day
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
>>Use Prelude's pseudo code to help build your C code
Don't you mean my pseudocode?
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
All prime numbers are odd. If it's an even number, it's not prime.Originally posted by Lurker
What would an easy way to detect odd prime numbers? Thanks!
Quzah.
Hope is the first step on the road to disappointment.
>>Don't you mean my pseudocode?
That was my fault, my brain had a GPF, and I put the wrong name by mistake. Like I said, long day...
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]