Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %task 1 default
- summ(0,0).
- summ(N,X):- N1 is N-1, summ(N1,X1), X is X1 + (4*N-1).
- %task 1 tail
- tail(0,T,T).
- tail(N,T,R):- N1 is N - 1, T1 is T + (4*N-1),tail(N1,T1,R).
- %task 2
- f(0,1).
- f(1,2).
- f(N,R):-
- N1 is N - 1,
- N2 is N - 2,
- f(N1,R1),
- f(N2,R2),
- R is R1 - 2 * R2.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement