Replying to my own question with another question. The problem I see
with the example code in chapter 12 is that it prevents prime number
palindromes because of the A=:B*C constraint. To get around this, I
rewrote the example code for chapter 12 as:
proc {Palindrome_12_4 ?Sol}
sol(A) = Sol
X Y
in
A::1000#9999
X::0#9 Y::0#9
A=:X*1000+Y*100+Y*10+X
{FD.distribute ff [X Y]}
end
{Browse {Length {SolveAll Palindrome_12_4}}}
proc {Palindrome_12_6 ?Sol}
sol(A) = Sol
X Y Z
in
A::100000#999999
X::0#9 Y::0#9 Z::0#9
A=:X*100000+Y*10000+Z*1000+Z*100+Y*10+X
{FD.distribute ff [X Y Z]}
end
{Browse {Length {SolveAll Palindrome_12_6}}}
The 4 digit solution gives 90 solutions and the 6 digit gives 900 - nice
round numbers that I think I can reason why that's the combinations.
Which leaves the examples from chapter #9. From looking at the results,
I see a bunch of repeated numbers (1001 is the first two solutions I see
from the list returned by SolveAll). However, I haven't figured out the
reason for this duplication, nor a solution.
Thanks,
Chris Rathman
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users