Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nat(0).
- nat(X) :- nat(Y), X is Y + 1.
- ar_prog(N) :- nat(Diff), nat(L), ar_prog_helper(R, Diff, L), reverse(R, N).
- ar_prog_helper([], _, 0).
- ar_prog_helper([X], _, 1) :- nat(X).
- ar_prog_helper([H1,H2|T], Diff, L) :- L > 1, L1 is L - 1, ar_prog_helper([H2|T], Diff, L1), H1 is H2 + Diff.
Advertisement
Add Comment
Please, Sign In to add comment