Greetings.
I read that there are 72 magic squares of size 3 and all of them have sum=15.
But when I code it, I only get 8 solutions.
My code is simple:
magic_square(S) :-
S = [A, B, C, D, E, F, G, H, I ],
permutation([1, 2, 3, 4, 5, 6, 7, 8, 9], S),
sum_list([A, B, C], Sum),
sum_list([D, E, F], Sum),
sum_list([G, H, I], Sum),
sum_list([A, D, G], Sum),
sum_list([B, E, H], Sum),
sum_list([C, F, I], Sum),
sum_list([A, E, I], Sum),
sum_list([C, E, G], Sum).
Am I doing something wrong?