I have the following task in Prolog:
Find an assignment of the letters to digits (each letter to a different digit) so that the following product holds:
EAU * EAU = OCEAN
If the code for this is as follows:
:- use_module(library(clpfd)).
ocean(L) :-
L = [O,C,E,A,N],
L2 = [U|L],
all_different(L2),
L2 ins 0..9,
EAU #= E*100 + A*10 + U,
OCEAN #= O*10000 + C * 1000 + E*100 + A*10 + N,
EAU * EAU #= OCEAN,
labeling([], L2).
Can someone please explain the following:
What is the meaning of L2 ins 0..9 (Why is the range between these numbers?)
What is the meaning of multiplying the letters by these particular numbers *10000 + C * 1000 + E*100, and E*100 + A*10 + U etc.?
Many thanks in advance for any guidance provided.