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 My code is up to now: Can anyone help? It is very easy that you do not care about efficiency. :) X> 2 because
0 and
1 are not yourself
isPrime (2) IsPrime (X): - X> 2,% 0,1 are not primes 1 mod (X, 2),
IceReim (X): - X & gt; 1, Suk (X, X), + (between (2, x0, n), 0x mode is N).
Comments
Post a Comment