Problem #9

Prime Cryptarithm
Public 09/24/09 6xp Programming 42.6%

The following cryptarithm is a multiplication problem that can be solved by substituting digits from a specified set of N digits into the positions marked with *. If the set of prime digits {2,3,5,7} is selected, the cryptarithm is called a PRIME CRYPTARITHM.

* * *
x * *
-------
* * * *
* * * *
---------
* * * * *

Write a program that will find all solutions to the cryptarithm above for any subset of digits from the set {1,2,3,4,5,6,7,8,9}.

Sample Run
ENTER A SET OF DIGITS: 23468
2 2 2
x 2 2
------
4 4 4 <3 more not shown>
4 4 4
---------
4 8 8 4

The number of unique solutions = 4

Test your program with the prime digits 2357.What is the number of unique solutions?


Source:1993 USACO Qualifying Round 1
http://www.uwp.edu/sws/usaco/1993/Qual/prob.htm




You need to be a member to keep track of your progress.
Register


Time may end, but hope will last forever.

Other Challenge Sites

Contact

elasolova
[64][103][109][97][105][108][46][99][111][109]