"The Pierrot in the illustration is standing in a posture
that represents the sign of multiplication. He is indicating the
peculiar fact that 15 multiplied by 93 produces exactly the same digits
(1,395) differently arranged." The challenge is to find all possible
sets of 4 digits with the same property. The four digits may be
divided into two 2-digits numbers as in the illustration, or into a single
number multiplied by a 3-digit number.
Background & Techniques
This fallacy is puzzle #84 from the book "Amusements in Mathematics" by
H. E. Dudeney, Dover Publications. Pierrot is a French
clown/mime apparently well known to Europeans, at least back in 1917 when
the book was originally published. In his original version it
was specified that all of the digits be different; I have relaxed this
restriction which adds 3 solutions to the 6 that Dudeney found.
Dudeney did not consider zeros at all - allowing zeros among the digits, but
not counting leading zeros in the product adds 6 more solutions. Add
finally allowing leading zeros in the product adds two more.
This program is mainly a programming exercise since there is not
much user interaction. Clicking the Search button will list all
17 solutions. Really not very useful unless you can find someone
to bet that there are not 17 solutions and you need to show them in order to
The program has about 75 lines of user code. Here are a couple of
things that I learned (or maybe relearned) in the process of coding this
A new function, SameDigits returns true if two passed
integers have the same digits (not necessarily in the same order).
It optionally considers leading zeros in making the comparison. I may
have written a similar routine before, but one of the advantages of growing
older is that we get to do lots of things over and over for the first time.
It took a while to figure out how to display leading zeros for the
outputs. The trick is to use the "precision" specifier (the number
after the decimal point) in a %d format string. For example,
Format('%6.4d',[N]); will return integer N right justified
into a 6 byte string and left padded with zeros out to 4 bytes. So 12
would display as 0012 preceded by two blanks.
Running/Exploring the Program