recursion - Check whether prime or not in Prolog -
I am trying to learn Prolog and I have found an example where I need to implement a program,
The argument I am attempting to follow is that to create an iterative rule, divide all the numbers against that number until it reaches the base case, or that So X> 2 because
0 and
1 are not yourself
My code is up to now:
isPrime (2) IsPrime (X): - X> 2,% 0,1 are not primes 1 mod (X, 2), Can anyone help?
It is very easy that you do not care about efficiency.
IceReim (X): - X & gt; 1, Suk (X, X), + (between (2, x0, n), 0x mode is N). :)
Comments
Post a Comment