eyeprolog 0.5.9 → 0.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37,19 +37,9 @@ divides(A, B) :-
|
|
|
37
37
|
(B > 0),
|
|
38
38
|
(0 is B mod A).
|
|
39
39
|
|
|
40
|
-
smallest_divisor_from
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
smallest_divisor_from(N, D, N) :-
|
|
44
|
-
(D2 is D * D),
|
|
45
|
-
(D2 > N).
|
|
46
|
-
|
|
47
|
-
smallest_divisor_from(N, D, S) :-
|
|
48
|
-
\+ divides(D, N),
|
|
49
|
-
(D2 is D * D),
|
|
50
|
-
(D2 =< N),
|
|
51
|
-
(D1 is D + 1),
|
|
52
|
-
smallest_divisor_from(N, D1, S).
|
|
40
|
+
% smallest_divisor_from/3 is supplied by eyeprolog-library.pl. Its
|
|
41
|
+
% implementation is plain Prolog and avoids repeating a long trial scan for
|
|
42
|
+
% values that are prime.
|
|
53
43
|
|
|
54
44
|
trial_prime(2).
|
|
55
45
|
trial_prime(3).
|