**From New Scientist #2329, 9th February 2002** [link]

The months MAY, JUN, JUL and AUG are indicated in the two multiplications shown where all the digits have been replaced by capital letters and asterisks. In these multiplications, and in the clues that follow, different capital letters stand for different digits but the same capital letter always stands for the same digit while the asterisks can be any digit.

Typically, the months JAN and MAR are both exactly divisible by 31, and of course you can also assume that any YEAR is exactly divisible by 12 or even 52.

What is the product of each multiplication?

[enigma1173]

### Like this:

Like Loading...

This Python program runs in 37ms.

Solution:The result of the first multiplication sum is 35109. The result of the second multiplication sum is 45696.The complete multiplication sums are shown below:

JAN = 341 (11×31), MAR = 248 (8×31), YEAR = 9048 (754×12, 174×52).

It is possible to use the generalised alphametic solver (

SubstitutedExpression()) from theenigma.pylibrary to solve this one. And it can be called directly from the command line without having to write a program.We could introduce 28 additional symbols for the asterisks (using the

--symbols="<string>"parameter) and then use the--distinct="<string>"parameter to limit the letters actually given in the diagram to be distinct, while the the remaining additional symbols can take on any value. This would allow us to read off the values for the complete sums from the solution.But as we don’t care about most of their values here I have just used additional symbols (lower case letters) for the multiplicands of the sums, and then I have used expressions to ensure that the intermediate multiplications in the sums are the correct “shape”.

Finally the

--answer="<expr>"parameter is used to display the results of the sums.The command runs in 178ms.