Free Trial

General Discussions

Discuss any topics that are not product-specific here.
SOLVED

[Looking for Challengers] Make 10 Puzzle

gawa
16 - Nebula
16 - Nebula

Hi, all

 

This post is not for question, but just for a fun to Alteryx experts.

I'm looking for somebody who can solve the puzzle 'Make 10' I created before, that was originally prepared for our company's training material but I didn't actually publish because it's too difficult. As it is no worth of keeping it in my 'warehouse' forever, I decided to publish it here.

 

Here is the description of Make 10 puzzle

=======================================================================================

For the given 4-digit numbers, make 10 according to the following rules. Find how many number of 4-digit numbers can make 10 out of 10,000 4-digit numbers(0000 through 9999).
(1) Regard 4-digit number as  four separate 1 digit numbers, and try to make 10 by using only four arithmetic operations(sum(+), substract(-), multiple(*), divide(/)).
(2) You can use brackets as many as you want.
 
(example)
'1234' can make 10 ; 1+2+3+4=10
'1358' can make 10 ; 8+(5-3)x1=10
'1158' can make 10 ; 8/(1-(1/5))=10
'1111' can NOT make 10
'7777' can NOT make 10
 
Hint: '1234' and '4321' are different number but they are essentially identical in terms of make 10. 

 

=======================================================================================

Input file and answer is given in the attached yxmd file. Looking forward to seeing your solution!

 

*For your information, though I tried to optimize my solution against this puzzle as much as possible, execution time of my WF could not be shorter than 2minutes...😅

 

4 REPLIES 4
CoG
14 - Magnetar

@gawa, you posted .yxmd instead of .yxzp

 

Cool problem!

gawa
16 - Nebula
16 - Nebula

@CoG  Good catch! You got part1 star Please go to part2!

(In other word, I apologize for inconvenience and replaced the start file in yxzp format)

CoG
14 - Magnetar

This was quite tough to pin down the cases, but I finally got them all with a little help from python to check my work. Runs in 1.7 seconds :)

Spoiler
_Main.png

The key is to recognize that most parentheses combinations correspond to evaluating the same formula in a step-wise fashion for different permutations of the digits (with the only exception for 4 digits being the product of sums and the sum of products (for simplification - we can't forget about subtraction & division either) where 2 separate operations must be performed and captured in memory before being brought together)
Example:
8*(1+2+3) = 1 + 2 + 3 * 8 performed from left to right, which more precisely looks like ((1+2)+3)*8.

As mention 2 exception cases would be:
(1+1)*(9-4) & (3*3)+(6/6)
Notice how there is no way to rearrange these expressions to solve from left to right without the parentheses.

Happy Solving to others who attempt this problem!!!

gawa
16 - Nebula
16 - Nebula

This is my WF, with Dynamic Replace tool, that takes 2 minutes in my laptop. AMP must be turned on.(I don't know the reason but without AMP engine it outputs wrong answer. It may have something wrong in Dynamic Replace tool)

Spoiler
Main WF:
1) Find the distinct numbers in terms of make 10 rule (like wise 1234 is equal to 4321). Doing this reduce the record to 715 from 10,000. 
2) Send to Batch macro to judge make 10 is possible or not for each
image.png
Batch Macro:
1) Create all possible expression(permutation of number, operand, and parentheses)
2) Go to Dynamic Replace tool to judge the generated expression is TRUE or FALSE
image.png
image.png

@CoG 

Thank you for your challenge!! Great work! Your solution always inspires me:)

Labels
Top Solution Authors