Solving problems with near infinite potential solutions
Posted
by
Zonda333
on Stack Overflow
See other posts from Stack Overflow
or by Zonda333
Published on 2010-12-17T06:49:43Z
Indexed on
2010/12/22
0:54 UTC
Read the original article
Hit count: 173
Today I read the following problem:
Use the digits
2, 0, 1, 1
and the operations+, -, x, ÷, sqrt, ^ , !, (), combinations, and permutations
to write equations for the counting numbers 1 through 100.
- All four digits must be used in each expression.
- Only the digits 2, 0, 1, 1 may be used, and each must be used exactly once.
- Decimals may be used, as in .1, .02, etc.
- Digits may be combined; numbers such as 20 or 101 may be used.
Example: 60 = 10*(2+1)!, 54 = ¹¹C2 - 0!
Though I was able to quickly find around 50 solutions quite easily in my head, I thought programming it would be a far superior solution. However, I then realized I had no clue how to go about solving a problem like this.
I am not asking for complete code for me to copy and paste, but for ideas about how I would solve this problems, and others like it that have nearly infinite potential solutions.
As I will be writing it in python, where I have the most experience, I would prefer if the answers were more python based, but general ideas are great too.
© Stack Overflow or respective owner