Goldbach’s Conjecture in prolog
问题 Goldbach’s Conjecture : Every positive even number greater than 2 is the sum of two prime numbers. Eg 28 (5,23 and 11,17) I want Prolog code to print below (all combinations) : ?- goldbach(28, L). Output : L = [5,23]; L = [11, 17]; I have a code which prints single combination[5,23], but not the next [11,17]. is_prime(2). is_prime(3). is_prime(P) :- integer(P), P > 3, P mod 2 =\= 0, \+ has_factor(P,3). has_factor(N,L) :- N mod L =:= 0. has_factor(N,L) :- L * L < N, L2 is L + 2, has_factor(N