diff --git a/script.pl b/script.pl
@@ -3,14 +3,14 @@
% Let S: N -> N be the sum of the digits of a positive integer.
% For all A and B in N, S(A + B) = S(A) + S(B) - 9k, where k is an integer.
-sum_digits(X, Y) :- sum_digits_acc(X, 0, Y).
+sum_digits(X, Y) :- sum_digits(X, 0, Y).
-sum_digits_acc(X, A, Y) :- X < 10, !, Y is A + X.
-sum_digits_acc(X, A, Y) :-
- Q = X div 10,
- R = X mod 10,
- A2 = A + R,
- sum_digits_acc(Q, A2, Y).
+sum_digits(X, Acc, Y) :- X < 10, !, Y is Acc + X.
+sum_digits(X, Acc, Y) :-
+ Q = X div 10,
+ R = X mod 10,
+ Acc1 = Acc + R,
+ sum_digits(Q, Acc1, Y).
test_pair(A, B) :-
R = 0,
@@ -22,9 +22,9 @@ test_pair(A, B) :-
D = SC - SAB,
R =:= D mod 9.
-iter(A, B) :-
- forall(between(0, B, X), test_pair(A, X)).
+iter(A) :-
+ forall(between(0, A, B), test_pair(A, B)).
-conjecture(M) :-
- forall(between(0, M, X), iter(X, X)).
+conjecture(Mod) :-
+ forall(between(0, Mod, A), iter(A)).