Edit: I will be posting a newer version of this question on meta-golf
soon. Stay tooned!
Edit #2: I will no longer be updating the challenge, but will leave it open. The meta-golf
version is available here: https://codegolf.stackexchange.com/questions/106509/obfuscated-number-golf
Background:
Most numbers can be written with only 6 different symbols:
e
(Euler's Constant)-
(Subtraction, Not Negation)^
(Exponentiation)(
)
ln
(Natural Logarithm)
For example, you could convert the imaginary number i
using this equation:
(e-e-e^(e-e))^(e^(e-e-ln(e^(e-e)-(e-e-e^(e-e)))))
Goal:
Given any integer k
through any reasonable means, output the shortest representation possible of that number using only those 6 symbols.
Examples:
0 => "e-e"
1 => "ln(e)"
2 => "ln(ee)"
// Since - cannot be used for negation, this is not a valid solution:
// ln(e)-(-ln(e))
-1 => "e-e-ln(e)"
Notes:
- Ending parenthesis count towards the total amount of characters.
ln(
only counts as 1 character.- Everything else counts as 1 character.
n^0=1
- Order of operations apply
- Parenthesis multiplying is acceptable, e.g.
(2)(8)=16
,2(5)=10
, andeln(e)=e
. ln e
is not valid, you must doln(e)
ln(ee...e)
) is the best way to portray positives. Edit: no, its not.ln(e^(ln(eeeee)ln(eeee)))
is better for 20 \$\endgroup\$ln(eeee)^ln(ee)
is a shorter thanln(eeeeeeeeeeeeeeee)
for 16 \$\endgroup\$