anthem-rs/examples/example-prime.lp

4 lines
122 B
Plaintext
Raw Normal View History

2020-05-19 12:57:09 +02:00
% Prime numbers from 1 to n.
composite(N) :- N = 1..n, I = 2..(N - 1), N \ I = 0.
prime(N) :- N = 2..n, not composite(N).