Related Challenge: Single Digit Representations of Natural Numbers
Task
Write a program/function that when given a non-negative integer \$n \le 100000\$ outputs an expression which uses all the digits from \$0\$ to \$9\$ exactly once and evaluates to \$n\$
The expression outputted by your program may only use the operations listed below:
- addition
- subtraction and unary minus (both must have the same symbol)
- multiplication
- division (fractional, i.e. 1/2 = 0.5)
- exponentiation
- parentheses
Note: Concatenation is not allowed
Output Format
- Output can be a string, list of operations and numbers or a list of lists in place of brackets.
- You may choose the precedence of the operators but it must be consistent for all outputs produced by your program/function
- Output may be in polish, reverse polish or infix notation but it must be consistent for all outputs produced by your program/function.
- You can use custom symbols for representing the digits and operations but the symbols used for representing the digits and operations should be distinct.
Scoring
This is code-golf so shortest bytes wins
Sample Testcases
0 -> 0 ^ (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9)
4 -> (0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8) / 9
7 -> 0 * (1 + 2 + 3 + 4 + 5 + 6 + 8 + 9) + 7
45 -> 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0
29 -> 1 + 2 + 7 + 6 + 5 + 4 + 3 + 0 + (9 - 8)
29 -> (((9 + 8 + 7 + 6) * 0) + 5 + 4) * 3 + 2 * 1
100 -> (9 * 8) + 7 + 4 + 5 + 6 + 3 + 2 + 1 + 0
A proof by exhaustion (also contains program used to generate the proof) that shows that all number less than or equal to \$100000\$ have an expression that uses all the digits.
<10
would be handy, too. \$\endgroup\$