### Random Post

### Recent Posts

### Recent Comments

Jim Randell on Tantalizer 461: Bea in her… | |

Jim Randell on Enigma 436: Sixes and sev… | |

Julian Gray on Enigma 436: Sixes and sev… | |

Jim Randell on Enigma 436: Sixes and sev… | |

Brian Gladman on Enigma 1074: Changing tim… |

### Archives

### Categories

- article (11)
- enigma (1,149)
- misc (2)
- project euler (2)
- puzzle (38)
- site news (44)
- tantalizer (39)
- teaser (3)

### Site Stats

- 175,102 hits

See also:

Enigma 1123,Enigma 1175,Enigma 1291,Enigma 1368,Enigma 1476,Enigma 1544.This puzzle can be solved using the

SubstitutedExpression()solver from theenigma.pylibrary.This run file executes in 82ms.

Solution:The square root of (NINE × FOUR × ONE) is 73872.This Python programme ran in 46 msec.

No. 1425 is an expanded version of this one.

Here’s a Picat model that takes about 10ms to solve. Note that the square root calculation is done after solve. Hence all variables are assigned and we can use the non-CP variant sqrt/1. (One can also use a square_root/1 constraint similar to perfect_square/1, but it’s not needed.)

A comment about perfect_square/1: the domains for Y is restricted by fd_min_max/3 which simplifies the model.

(A similar MiniZinc model is slower: about 100ms.)

@hakank: Thanks for posting your Picat model. For some reason I don’t get any output when I try and run it, but if I replace the

modconstraints at lines 14-16 with:then I do get the expected answer.

@jim. Ah. I assume that you are running Picat v 2.1#3 (the latest official release). It has a bug regarding larger domains in certain cases. I happen to run the forthcoming version where this bug is fixed. 🙂 Sorry about that. I hope the new version will be released soon.

I used Hakank’s square predicate and it ran in 64 msec, but ’round’ did not work for me in the output.

@geoffrounce Nice! For my own MiniZinc model I didn’t use sqrt like that.

Regarding round: There is no support for “round(var int)” in MiniZinc. However, when using values in the output like this, one can use “fix(…)” to convert to a non-var parameter and then use “round()”. So this works: