Guest User

Untitled

a guest
Jan 15th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.28 KB | None | 0 0
  1. problem001(M, S) :-
  2.         sub(M, 0, 0, 0, S).
  3.  
  4. sub(M, _, J, K, K) :-
  5.         J >= M.
  6.  
  7. sub(M, I, J, K, S) :-
  8.         J < M,
  9.         I1 is (I + 1) mod 7,
  10.         nth0(I, [3, 2, 1, 3, 1, 2, 3], A),
  11.         J1 is J + A,
  12.         K1 is J + K,
  13.         sub(M, I1, J1, K1, S).
Add Comment
Please, Sign In to add comment