Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- problem001(M, S) :-
- sub(M, 0, 0, 0, S).
- sub(M, _, J, K, K) :-
- J >= M.
- sub(M, I, J, K, S) :-
- J < M,
- I1 is (I + 1) mod 7,
- nth0(I, [3, 2, 1, 3, 1, 2, 3], A),
- J1 is J + A,
- K1 is J + K,
- sub(M, I1, J1, K1, S).
Add Comment
Please, Sign In to add comment