[Question]
  [
Given a number n, find x such that x! = n, where both x and n are positive integers. Assume the input n will always be the factorial of a positive integer, so something like n=23 will not be given as input.
Examples: `n=1 -> x=1` (0 is not a positive integer), `n=24 -> x=4`
Shortest code wins.
  
[Answer]
# [Python 2](https://docs.python.org/2/), 28 bytes (input \$\leq2^{64}\$)
```
lambda n:len(`n**8L`)**.6//1
```
[Try it online!](https://tio.run/##NU5BCsJADLzvK3pse9Akm02ygj/wCR5UVCzUtUhFfH3NCgbCzITJJNNnvj0KLdftfhmP99P52JTNeCntofS97Q5d369kvcblfRvGS4Ob6TmUubm2Q5lec9t1CwYKEogDEgT1TsAQGKLTKGT2B8ecUSphzQAozoRIgaAOTVGNssdAwAgqyrG6IRBkt1k2@8mYkpgyGWSpWhgoalRISj8DEgonBH/EzP@oERwp@yEwVPEFry8 "Python 2 – Try It Online")
This works on inputs up to \$20! =2432902008176640000 \$ that fall within 64-bit integers. 
This uses an approximate fit inspired by [Stirling's approximation](https://en.wikipedia.org/wiki/Stirling%27s_approximation). However, the constants were estimated manually and it breaks down for larger values. With Python not having a built-in `log`, we use the digit-length for \$n^8\$ as an approximation for \$c\cdot\log(n)\$. Actually, we use the long value `8L` so that the string representations uniformly end in `L` for "long", which adds one to the lengths.
From there, raising the value to the power of \$0.6\$ and taking the integer part is apparently sufficient to give the correct output up to \$20!\$. It's lucky that the `0.6` is `0.60`, since we'd usually need another digit of precision.
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 2 bytes
```
¯!
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn//9B6xf9pj9omPOrte9TVfGi98aO2iY/6pgYHOQPJEA/P4P9pCoYKRgpmCkYmCoZGBgrmQGxqYGKgYGJgDGQamxlZWBgAAA "APL (Dyalog Extended) – Try It Online")
Exactly the same as [non-extended APL answer](https://codegolf.stackexchange.com/a/205049/78410) but just with the shorter syntax.
`!` is factorial function, `¯` prefix gives the inverse function of it.
[Answer]
# [Python 2](https://docs.python.org/2/), 32 bytes
```
f=lambda n,k=2:n and-~f(n/k,k+1)
```
[Try it online!](https://tio.run/##HcpBDsIgEAXQfU/xd4VINbBsgncZW6ETykAIGzdeHU23L69@@lHEjRH8Sfm1E8Qk71YByb58g5JHMulm9eBcS@vI1I8plAYGCxpJfCtrYJ1eJyDCX@MeaOulMZ2K9d9rY@mIBvPynA2Cinr8AA "Python 2 – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
!€i
```
[Try it online!](https://tio.run/##y0rNyan8/1/xUdOazP///xsaGQAA "Jelly – Try It Online")
```
  i    The first index (from 1) of the input in
!€     the factorials of every integer from 1 to the input.
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 3 bytes
```
ℕ₁ḟ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r//1HL1EdNjQ93zP//P@q/kQkA "Brachylog – Try It Online")
A predicate which takes input reversed (i.e., the input is given through the output variable, and the output is given through the input variable). Brachylog more-or-less has a builtin for exactly this, aside from needing to apply the additional constraint of having to output a positive integer, where I say more or less because it's also just the factorial builtin and it works in both directions.
[Answer]
# [J](http://jsoftware.com/), 4 bytes
```
!inv
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/FTPzyv5rcilwpSZn5CukKRiZwFjGZkYWFgYwnqKRwX8A "J – Try It Online")
Inverse of factorial.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~33~~ ~~29~~ 28 bytes
Saved a byte thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)!!! 
```
x;f(n){for(x=0;++x-n;n/=x);}
```
[Try it online!](https://tio.run/##TY7NqsIwFIT3PsVQEBKTYvrjH7FuLj6FdSHVahZGaboIlj57PfW2YiBzGM58nCnCa1F0ndcls7wpHxXzmdJC@NBqO8881213PxnLOJoJ6Blbo7642h2OyNBEErHEkjSViGIlseploVLSVCW9SZbxeq1a/eGL26maofqng9zv49xv/ugvAolfnwQDQaXA@rOGEKVpbOHM6/Io2acInw@OMlxDCDN2Hfs6AofwwRy5/i6fFa1LFkzPCHcgnbrcUo8xKuEkdSU@o7MC0Qi3k7Z7Aw "C (gcc) – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 27 bytes
```
->n,x=0{2>n/=x+=1or redo;x}
```
[Try it online!](https://tio.run/##HclBDoIwEAXQq/zgBgKO1C0ZbuAJ1JiqIF0wJbUkNaVnr9Hly3Pr/ZNHvuR9L03gNh57OXCoWVkHNzxtF1IuFZFqKxr0Y0LEZjYIGCftJ3rpedalqVXVYVn9G8WvdlHI25tJDcKf41muqUDKXw "Ruby – Try It Online")
Increment the divisor `x` (initially 0), divide `n` (initially the input value) by `x` and store the result as `n`, repeat until `n=1`. Then `x` is the desired output.
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 20 bytes
Mathematica has the inverse function of the factorial! It's called `InverseFunction@Factorial`. I used a pure (Mathematica for "anonymous") function that returns the factorial by using the exclamation mark, as it's shorter.
```
InverseFunction[#!&]
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE7872Yb898zryy1qDjVrTQvuSQzPy9aWVEt9n9AUWZeiYNbtKGBYux/AA "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 4 bytes
```
Å!g<
```
[Try it online!](https://tio.run/##yy9OTMpM/f//cKtius3//4ZGBgA "05AB1E – Try It Online")
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 39 bytes
```
.+
1 $&$*
+`^(1+) (1\1)+$
1$1 $#2$*
\G1
```
[Try it online!](https://tio.run/##K0otycxL/K@q4Z7wX0@by1BBRU1Fi0s7IU7DUFtTQcMwxlBTW4XLUAUooWwElIlxN/z/35DLiMuMy8iEy9DIgMsciE0NTAwA "Retina 0.8.2 – Try It Online") Link includes test cases. Actually calculates the largest factorial that divides `n`. Explanation:
```
.+
1 $&$*
```
Set `x` to `1` and convert `n` to unary.
```
^(1+) (1\1)+$
1$1 $#2$*
```
If `x+1` divides `n`, then increment `x` and divide `n` by the incremented `x`.
```
+`
```
Repeat the above until `x+1` does not divide `n` (hopefully because `n=1` at this point).
```
\G1
```
Convert `x` to decimal.
[Answer]
# [R](https://www.r-project.org/), ~~29~~ 28 bytes (input ≤170!)
```
match(scan(),cumprod(1:170))
```
[Try it online!](https://tio.run/##dYs5DsJAEARzXmJLBDM9Z/MbywQkBsTx/mU/QGWt6nqNcWyf/ba89@2@rOf9ezxfj@uiFy1Z10EzJDTcje4ayNYkYd2RyCwRp5QGs5Fu00I9OwimNQNawYkBpEZK0@fBWDlXaKMTYckipFGAVTRCtWcr1Ox0@cNp/AA "R – Try It Online")
Input is limited to 170!, which is the largest factorial that can be handled as a floating-point number by R; in any case, at larger values, there is a risk that truncated digits in the internal floating-point encoding will affect the output. Obviously the second issue will be fixed when run on an imaginary 'unlimited-precision' R implementation, but the input limitation will always be there (or, with slight modification, a limitation to ≤999!). So... 
# [R](https://www.r-project.org/), ~~38~~ 34 bytes
```
n=scan();while(n>(T=T*(F=F+1)))n;F
```
[Try it online!](https://tio.run/##TcExCoAwDAXQ67S6JE38iUgdewIvICIoSAcdPH5dfe9ureZnW2uI03uc1x7qHJa8dKHk0nOMsU6lCSkrjZKIjUXMSQWcQM4AQQ3uqmIG5QE@ggZO9NM@ "R – Try It Online")
*Edit: -4 bytes thanks to tip from Giuseppe*
This version is still subject to the precision limitations of the R implementation, but could (in principle) be run with unlimited input. 
Edit: Obviously the ~~large~~ increase in program length to achieve the unimplemented ability to run on unlimited input is rather unsatisfying, so...
# [R](https://www.r-project.org/), ~~30~~ 29 bytes
```
match(n<-scan(),cumprod(1:n))
```
[Try it online!](https://tio.run/##K/r/PzexJDlDI89Gtzg5MU9DUye5NLegKD9Fw9AqT1Pzv7mRwX8A "R – Try It Online")
Only one-byte longer than the input-limited attempt. Unfortunately, on all current R implementations, it is rather slow and is likely to crash with anything but small input values, but - in the words of Osgood Fielding III - 'well, nobody's perfect'
[Answer]
# [dc](https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html), 22 bytes
```
0?[r1+d_3R/d1<F]dsFx/p
```
[Try it online!](https://tio.run/##lY5LTkNRDEMXxKCJncSJhMSsC2CKEIO@BVQwYfePtDsg0v1Iduxz3M7T3j6@/eX44vvl8Nfr5/Fz/b3cz1PdleoSKzSWxkywCOfs1WkFTDpzpGq5iFUnFEgSEatEzBTDyMDAaIEOc5@OAsfCJfhG9vgau2lIVWAbEZsn3@byQRViEo0Zujt3v1OQqUgXKE5N9wQHW54Fj/TarNjMBwLGu8LpwDJuUnQSUm7Tw6XcDFvyPb4YYZmarK4yoIz@BH46lj73a52tKVdv6c6@q6ylR1QI9t/5Aw "dc – Try It Online")
Input on stdin, and output on stdout.
Works for arbitrarily large inputs (up to the available memory). The TIO sample run is for `200!`.
**How it works**
The description below presumes that the input is a factorial (so all the divisions have no remainder).
```
0
?     # Stack is now (top of stack on right):
      #    x n
      #    where x = 0 and n is the input number.
[     # Define a macro (to be used as a loop).
      #    If we write the stack as
      #    x n
      #    then we assert the following loop invariant at this point in the cycle:
      #       n = input / x!
  r      # Swap.        Stack: n x
  1+     # Increment.          n x+1
  d      # Duplicate.          n x+1 x+1
  _3R    # Rotate 3 steps clockwise.
         #                     x+1 n x+1
  /      # Divide.             x+1 n/(x+1)
  d1<F   # If n/(x+1) > 1, go back to the beginning of the loop.
         #    Note that the loop invariant is once again true,
         #    as it should be at the beginning of a new loop iteration.
]dsFx # End macro, call it F, and execute it.
      # When we leave the loop, we know the following, where 'x n' is the current stack:
      #   (1) the loop termination condition was false, so n <= 1,
      #       and we must actually have
      #       n = 1
      #       because the input was a factorial;
      #   and
      #   (2) the loop invariant is true, so n = input / x!
      #
      #   It follows that x! = the input, and the stack is now:
      #                              x 1
/     # Divide (to pop the 1).       x
p     # Print top of stack.
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 4 bytes
```
.I*F
```
[Try it online!](https://tio.run/##K6gsyfj/X89Ty@3/f3MjAwA "Pyth – Try It Online")
### Explanation
```
.I*F
.I    : Inverse function of
  *F  : factorial
```
---
# [Pyth](https://github.com/isaacg1/pyth), ~~6~~ 5 bytes
```
fqQ*F
```
[Try it online!](https://tio.run/##K6gsyfj/P60wUMvt/39zIwMA "Pyth – Try It Online")
-1 byte thanks to [@FryAmTheEggman](https://codegolf.stackexchange.com/users/31625/fryamtheeggman)
### Explanation
```
fqQ*F
f      : First positive integer value where
  Q    : input
 q     : is equal to
   *F  : factorial of value
```
[Answer]
# Clojure, 73 bytes
```
(defn f[n](loop[x 1](if(= n(reduce *'(range 2(inc x))))x(recur(+ x 1)))))
```
Ungolfed:
```
(defn find-fact [n]  ; n = x!. Find x
  (loop [x 1]
    (if (= n (reduce *' (range 2 (inc x))))
      x
      (recur (+ x 1)))))
```
Tested out to 1234!, which is the 3281 digit number `51084981466469576881306176261004598750272741624636207875758364885679783886389114119904367398214909451616865959797190085595957216060201081790863562740711392408402606162284424347926444168293770306459877429620549980121621880068812119922825565603750036793657428476498577316887890689284884464423522469162924654419945496940052746066950867784084753581540148194316888303839694860870357008235525028115281402379270279446743097868896180567901452872031734195056432576568754346528258569883526859826727735838654082246721751819658052692396270611348013013786739320229706009940781025586038809493013992111030432473321532228589636150722621360366978607484692870955691740723349227220367512994355146567475980006373400215826077949494335370591623671142026957923937669224771617167959359650439966392673073180139376563073706562200771241291710828132078928672693377605280698340976512622686207175259108984253979970269330591951400265868944014001740606398220709859461709972092316953639707607509036387468655214963966625322700932867195641466506305265122238332824677892386098873045477946570475614470735681011537762930068333229753461311175690053190276217215938122229254011663319535668562288276814566536254139944327446923749675156838399258655227114181067181300031191298489076680172983118121156086627360397334232174932132686080901569496392129263706595509472541921027039947595787992209537069031379517112985804276412719491334730247762876260753560199012424360211862466047511184797159731714330368251192307852167757615200611669009575630075581632200897019110165738489288234845801413542090086926381756642228872729319587724120647133695447658709466047131787467521648967375146176025775545958018149895570817463048968329692812003996105944812538484291689075721849889797647554854834050132592317503861422078077932841396250772305892378304960421024845815047928229669342818218960243579473180986996883486164613586224677782405363675732940386436560159992961462550218529921214223556288943276860000631422449845365510986932611414112386178573447134236164502410346254516421812825350152383907925299199371093902393126317590337340371199288380603694517035662665827287352023563128756402516081749705325705196477769315311164029733067419282135214232605607889159739038923579732630816548135472123812968829466513428484683760888731900685205308016495533252055718190142644320009683032677163609744614629730631454898167462966265387871725580083514565623719270635683662268663333999029883429331462872848995229714115709023973771126468913873648061531223428749576267079084534656923514931496743842559669386638509884709307166187205161445819828263679270112614012378542273837296427044021252077863706963514486218183806491868791174785424506337810550453063897866281127060200866754011181906809870372032953354528699094096145120997842075109057859226120844176454175393781254004382091350994101959406590175402086698874583611581937347003423449521223245166665792257252160462357733000925232292157683100179557359793926298007588370474068230320921987459976042606283566005158202572800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`
[Answer]
# [MATLAB/Octave], ~~35 34~~ 26 bytes
```
f=@(n)nnz(cumprod(1:n)<=n)
```
Thanks @David for the feedback! I added the f= to have way to call the function for 2 bytes.
[Answer]
**SWI-Prolog, 50 bytes**
```
:-[library(clpfd)].
c(F,N):-F#=1,N#=1;c(F//N,N-1).
```
[Try it online!](https://tio.run/##fVBNSwNRDDzrr3hFhC68bfOdvIrXHvfsBx50RSkstKwH8devWbw7kDlMMmGSy3yezp/91/dpWQ7983R6m1/nn@04XT7eu5fd9bg91qE79Mebe6xD0l0q@/1Qhx673bKMW5JaHrparlbcllJkky4yRoZga7yWMqA5YQASGvyhlsdut1qYVguHGoEEsZEGCKGzmjuYNmIxNgFDl8YITRsQ8coeQSHA5MbOAqSuaKqSZrAwtNAIBWdDzT4DKAYzaDQ0Fs/t6NSYyEhajrqbIUpTJVHgTJ8KQEYQcWjkjcQtKSdCKeB/1PKUZ66/QYrNLw "Prolog (SWI) – Try It Online")
`c(F,N)` recursively defines factorials, either F = N = 1, or F/N is (N-1)!. To save bytes we used integer division, so the answer is only valid if F is actually a factorial. Prolog infers the correct value for N if not specified.
Algorithm should work for all inputs, although it isn't particularly fast. Tested up to 128!.
[Answer]
# [Rust](https://www.rust-lang.org/), ~~41~~ 32 bytes
```
|mut y|(1..).find(|x|{y/=x;y<2})
```
[Try it online!](https://tio.run/##LY3BDsIgGIPve4q6E5gFMz1OHoaof0Ky/S4IGQvw7LjpemvTr3Xh4ysxJmNZSKQGGF8egck8PHTNU/BYs@iVkoosP0WOOa0XHYf1fi2yAsPB7E2CRr8H9HaIsIwN7G@/3U2Es0Yc/mZ2lv3IJ9GmAq2RStshdse3IKkCL87MQsqdKE2pXw "Rust – Try It Online")
The `.unwrap()` was unnecessary ([Meta post](https://codegolf.meta.stackexchange.com/a/14275/97519)), saving 9 bytes
[Answer]
# [Husk](https://github.com/barbuz/Husk), 4 bytes
```
€mΠN
```
[Try it online!](https://tio.run/##yygtzv7//1HTmtxzC/z@//9vZAIA "Husk – Try It Online")
```
€     the index of implicit input in ...
 mΠ   ... map factorial over ...
   N  ... the natural numbers
```
[Answer]
# [Erlang (escript)](http://erlang.org/doc/man/escript.html), 45 bytes
Quite similar with ovs's Python answer.
```
f(1.0,Y)->Y;f(X,Y)->f(X/Y,Y+1).
f(X)->f(X,2).
```
[Try it online!](https://tio.run/##Sy3KScxL100tTi7KLCj5z/U/TcNQz0AnUlPXLtI6TSMCzALS@pE6kdqGmnpcQDZERMdIU@9/bmJmnkZ0rKaCrh2XAhBk5luVF2WWpGqkaRiZaAIVAAA "Erlang (escript) – Try It Online")
[Answer]
# [COW](https://bigzaphod.github.io/COW/), 108 bytes
```
oomMOoMOOMoOMMMOOOmoOMMMmoOMoOmOoMOOmoOMMMmoOMMMMOOMOomOomOoMOomoOmoOmoomOomOomOoMoOmoOmoomOoMOomoomoOmoOOOM
```
[Try it online!](https://tio.run/##TYvBCcAwDANXKimULCE0RN5Gz4zv2iLQgrDF@by0M6UABRIiUJvh0lMMnz5io/xwuojOIQ1/xMJx6i/zfsac1ws "COW – Try It Online")
## Explanation
```
moo ]    mOo <    MOo -    OOO *    OOM o
MOO [    moO >    MoO +    MMM =    oom ^
[0]: n/(i!)     [1]: n/((i-1)!)     [2]: i     [3]: i_temp
^-                   ;  Read i in [0] and decrement it
[                    ;  Loop while [0] is non zero ( n/(i!)-1 is checked )
    +=*>=            ;      [0] is incremented and cut/copied in [1]
    >+<              ;      [2] is incremented
    [                ;      Loop while [1] is non zero ( repeated subtraction begins )
        >=>=         ;          Copy [2] in [3]
        [            ;          Loop while [3] is non zero
            -<<->>   ;              [3] and [1] are decremented ( [1] is guaranteed to be divisible by [3] )
        ]            ;
        <<<+>        ;          [0] is incremented
    ]                ;      [0] is now the product of the biggest x-i factor of n
    <-               ;  [0] is decremented so iff [0] = 1 the loop ends
]                    ;
>>o                  ;  Print [2] x
```
[Answer]
# Excel, 29 bytes
```
=MATCH(A1,FACT(ROW(1:170)),0)
```
[Answer]
# [Factor](https://factorcode.org/) + `math.factorials`, ~~41~~ 32 bytes
Saved 9 bytes thanks to @Bubbler!
```
[ dup [1,b] [ n! = ] with find ]
```
[Try it online!](https://tio.run/##HY49D4IwGIR3fsUxawgQ4@DHbFxcjFPDUMuLNpRSS4ka8bfja5cb7nlyuUaq0Pv5cj6eDhu05C0ZdDLcY2Re2hsNML2SZoDzFMLbeW0DBnqMZBXDKDZxR/@tbfJBgRJrlCsUZQ58kxRiwgsTcgiGC9Sjg0252qHi@d6hmkVsRbG8Vmwx3TN7av7SaFuz0EmHDMqQ9PMP)
# [Factor](https://factorcode.org/), ~~50~~ 34 bytes
Saved 16 bytes thanks to @Bubbler!
```
[ 1 over [1,b] [ * 2dup = ] find ]
```
[Try it online!](https://tio.run/##Tc0/D4IwEAXwnU/xXNUQIMbBP7NxcTFOhKFCUWJp67UoRvzsWJoYWV4uud@9K1luFfWn4/6wW@HGSXKBmtmrj5CYvHADoXImDDRxa1@aKmlh@L3hMndLD0vfUw1qHbwRI8ESyQJxEgGfYIK0Q4sOkVulME@m3TBD0WiQspj6qcUGmXumNEJk/6PYZRrPz5k7/cmtk2UlC2R96oB6cBqZZEAjUrOhMhecUf8F "Factor – Try It Online")
There's probably a better idiom for this, but I can't find it right now.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 4 bytes
I was just copying [Bubbler's solution](https://chat.stackexchange.com/transcript/message/54040431#54040431). I didn't write it, so it's community wiki.
```
!⍣¯1
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///X/FR7@JD6w3/pz1qm/Cot@9RV/Oh9caP2iY@6psaHOQMJEM8PIP/pykYmXClKRgaGQAA "APL (Dyalog Unicode) – Try It Online")
## Explanation
```
 ⍣¯1 The inverse of this function:
!    Factorial function
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 17 bytes
```
Ｎθ⊞υ¹Ｗ‹Πυθ⊞υＬυＩ⌈υ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/98zr6C0xK80Nym1SKNQ05oroLQ4Q6NUR8EQyC7PyMxJVdDwSS0u1ggoyk8pTS7RKNXUUSjU1FSAqfNJzUsvAbI0QXqLMvNKNJwTi0s0fBMrMnNLc0Himtb//xubGVlYGBj81y3LAQA "Charcoal – Try It Online") Link is to verbose version of code. Actually calculates the lowest factorial not less than `n`. Explanation:
```
Ｎθ
```
Input `n`.
```
⊞υ¹
```
Push `1` to the predefined empty list.
```
Ｗ‹Πυθ
```
Repeat while the product of the list is less than `n`.
```
⊞υＬυ
```
Push the length of the list to the list. (This means that the list has an extra `1` in it, but conveniently that doesn't affect the product.)
```
Ｉ⌈υ
```
Output the largest element of the list (which is also the last element; either operation works.)
[Answer]
# SimpleTemplate, 72 bytes
Not exactly the smallest, but works.
Uses a naive approach to calculate the factorial up to the chosen number, returning the value if found.
```
{@setf 1}{@forfrom 1toargv.0}{@set*f f,_}{@iff is equalargv.0}{@return_}
```
Notice that this is a *REAL* `{@return}`! The compiler method will give you this value.  
To be used as a function, simply wrap it in `{@fn invert_factorial} [...] {@/}`.
---
**Ungolfed version**
This should be easy to understand
```
{@set factorial 1}
{@for i from 1 to argv.0}
    {@set* factorial factorial, i}
    {@if factorial is equal to argv.0}
        {@return i}
    {@/}
{@/}
```
The line `{@set* factorial factorial, i}` simply stores ,in `factorial`, the result of multiplying the value `factorial` to `i`.
---
You can test this on:  
<http://sandbox.onlinephpfunctions.com/code/61cc7101a868a71d0a7a85cdde57f946bcb2586e>
[Answer]
# [Rust](https://www.rust-lang.org/), 57 bytes
```
fn f(mut y:i32)->i32{let mut x=1; while y>1{x+=1;y/=x;}x}
```
[Try it online!](https://tio.run/##zY9NboQwDIX3nMJlUSVqS4HpKojZ9Ag9QIWKp40UTJQ4IghxdupB6h268e97n@yQIh/HjeCmpsSwGntp9ctV4uaQ4T7LfdPB8mMdwnpttvwk/fra527P@5EiQuTRGDsbI4WlrigENw2WlIatAPjjROjhg4Olb2MIF6U7WZ4WpauAw/jpLKF6PLW6wuzxi1X5Pic3As0Mdw1Y8onL0@uFxY4eVLnt5bN8ECvBT0LzQ4goOdESBq@0Fv3/uWQ/mrYu3upLW/8C "Rust – Try It Online")
[Answer]
# [Burlesque](https://github.com/FMNSSun/Burlesque), 17 bytes
```
b01{+.}{?!.>}w!it
```
[Try it online!](https://tio.run/##SyotykktLixN/f8/ycCwWluvttpeUc@utlwxs@T/fyMTAA "Burlesque – Try It Online")
Explanation:
```
b0                # Parse input as base 10 integer
  1               # Push counter to the stack
   {+.}      w!   # Increment counter while
       {?!.>}     # The input is greater than the factorial of the counter
               it # Return just the counter
```
[Answer]
# [R](https://www.r-project.org/), ~~56~~ 52 bytes
```
function(n){while(n>(T=T*(F=F+gmp::as.bigz(1))))1;F}
```
[Try it online!](https://tio.run/##lY5ZSgNhEITfPUaeJgrSXb1H4mNOkAuoOHEgjuKCoHj2sZMb2PAvUNVf1dsybpfxc374mF7mYV7/fD1Nx8dhvh322/3lsNvurg7Pr5vN3fv1/XT4Hnjdwze732UcVpHpFukhrlFkJGYQF7BUX2nkQBmLVYRncAhaLQ2FiUC1FdUqFyURRYGEFKnEXKkOKVKOADcyi9uYKQQLV3QitHnBnexccIeWIVElzCy9nxYIChfhgISUV2apFDrcHKzG3ixt5qkCitOVhYHu2CRNE0RYJ51cYc2gbt6Hu4aSWZR5uhPgJHwufHZ0e@svpWWUc2SH9vTbSluyQkID9N9ZrS@WPw "R – Try It Online")
Thanks to [Dominic van Essen](https://codegolf.stackexchange.com/users/95126/dominic-van-essen) for the golfs and bug catch!
Takes input as a string.
[Answer]
# [Julia](https://julialang.org), 36 bytes
# [Try it!](https://tio.run/##DcdRCoAgDADQ62xQsJmFBHYXKQYLWWEG3t56f@98syZuXWK3cRO1Q7Q8FdqftNeraMrQMEYbeDXsd1GrIMCOFz8zkacQJkdEiP0D)
```
julia> f=n->findfirst(x->factorial(x)==n,1:n)
julia> @benchmark f(121645100408832000)
BenchmarkTools.Trial: 
  memory estimate:  0 bytes
  allocs estimate:  0
  --------------
  minimum time:     32.801 ns (0.00% GC)
  median time:      33.246 ns (0.00% GC)
  mean time:        33.661 ns (0.00% GC)
  maximum time:     56.452 ns (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     993
```
]