## Teaser 2947: 55 Divisions

**From The Sunday Times, 17th March 2019** [link]

To mark her 55th birthday, Martha, a school teacher, gave each of her nine pupils a sheet of paper with a single different digit from 1 to 9 written on it.

They stood at the front of the classroom in a row and the 9-digit number on display was divisible by 55. Martha then asked the first 3 in the row (from the left) to sit down. The remaining 6-digit number was also divisible by 55. The next 3 then sat down and the remaining 3-digit number was also divisible by 55.

The 9 digit number was the smallest possible. What was it?

[teaser2947]

## Jim Randell 6:25 am

on17 March 2019 Permalink |We can treat the problem as an alphametic puzzle, use the [[

`SubstitutedExpression()`

]] solver from theenigma.pylibrary to find all possible solutions, and then find the smallest of these.This Python program runs in 98ms.

Run:[ @repl.it ]Solution:The number is 143869275.There are 48 different solutions to the alphametic puzzle.

LikeLike

## GeoffR 2:46 pm

on19 March 2019 Permalink |LikeLike

## Jim Randell 11:09 am

on20 March 2019 Permalink |This puzzle is an ideal candidate for using the [[

`solve minimize(...)`

]] target in aMiniZincmodel.Also I didn’t know

MiniZinchad [[`enum`

]]. (In fact, in the tutorial I used I seem to remember there was a section on how it didn’t have them and how to emulate them. I suppose they must have come along in a later version).LikeLike

## GeoffR 12:14 pm

on20 March 2019 Permalink |The latest version of MiniZinc( Ver 2.2.3) has much improved documentation and a new menu, including timing for Windows and other features. It seems odd that a solution can be found in 20 -30 msec, but still takes over 200msec to finish.

Here is the link for enums:

https://www.minizinc.org/doc-2.2.3/en/spec.html#enumerated-types

LikeLike