Posted By: Ted22
Prime numbers - 04/17/10 15:24
Hi!I got a question.How can i tell the engine that if a / b = a rational number,something happens?Or more directly,how can i make the engine check if a number is prime?
Posted By: Lion_Ts
Re: Prime numbers - 04/18/10 12:00
engine cannot decide is the number prime or not. You can start here
http://en.wikipedia.org/wiki/Primality_test
Posted By: Ted22
Re: Prime numbers - 04/18/10 12:20
Ok,thanks,but can u answer to my first question?"How can i tell the engine that if a / b = a rational number,something happens?"
Posted By: Ted22
Re: Prime numbers - 04/18/10 12:25
for instance let's say that a = 5 and b = 2
Posted By: Rei_Ayanami
Re: Prime numbers - 04/18/10 12:28
if(a/b == integer(a/b))
{
do somethign
}
Posted By: Widi
Re: Prime numbers - 04/18/10 12:39
or:
if(!fraction(a/b))
{
do something
}
Posted By: Ted22
Re: Prime numbers - 04/18/10 13:32
Thank you!This is exacly what i was looking for!