This question already has an answer here:

Write program which finds shortest expression for big integer.
Expression may consist of + - * / ^ ! ( ) operations.
! stands for factorial, ^ - exponentiation, / - rational division.

Number itself should be printed when no shorter expression found.

7 - 7
120 - 5!
19683 - 3^9
191102976 - 4!^6

Code which is able to find shortest expression within 10 minutes or faster for each unsigned 64-bit number.


marked as duplicate by user80551, Digital Trauma, Martin Ender, Justin, gxtaillon Jul 22 '14 at 23:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ @MartinBüttner I've searched but didn't find that question. I can delete my question. \$\endgroup\$ – Somnium Jul 22 '14 at 19:03
  • \$\begingroup\$ Wait for a few other opinions. Yours allows a fixed set of operators instead of saying "optimise for a language of your choice". That's why I didn't close vote right away. (I actually tried finding it via the search as well, but failed, so I had to browse through my own answers.) \$\endgroup\$ – Martin Ender Jul 22 '14 at 19:04
  • \$\begingroup\$ I think this is sufficiently different from the other question. I don't know what the close votes are for, but I do think the input range needs to be specified (otherwise it could be any number up to infinity.). Also, be aware that fastest-code means the submissions must be tested on the same machine (your machine) so it's a lot of work for you. Code-golf is an easier choice for the poster. \$\endgroup\$ – Level River St Jul 22 '14 at 20:42

Browse other questions tagged or ask your own question.