[Question]
  [
This should be a simple challenge.
Given a number \$n \ge 0\$, output the [super-logarithm](https://en.wikipedia.org/wiki/Super-logarithm) (or the \$\log^\*\$, log-star, or [iterated logarithm](https://en.wikipedia.org/wiki/Iterated_logarithm), which are equivalent since \$n\$ is never negative for this challenge.) of \$n\$.
$$\log^\*(n) = \begin{cases}
0 & \text{ if } n \le 1 \\
1 + \log^\*(\log(n)) & \text{ if } n > 1
\end{cases}$$
This is one of the two inverse functions to [tetration](https://en.wikipedia.org/wiki/Tetration). The other is the [super-root](https://en.wikipedia.org/wiki/Super-root), which is in a [related question](https://codegolf.stackexchange.com/questions/20308/calculate-the-super-root-of-a-number).
### Examples
```
Input       Output
0           0
1           0
2           1
3           2
4           2
...
15          2
16          3
...
3814279     3
3814280     4
```
### Rules
* You do not need to support decimals, though you may.
* You need to support input of at least \$3814280 = \left\lceil e^{e^e} \right\rceil\$.
* **You may not hard-code the values like `3814280`. (Your program must *theoretically* support higher numbers.) I want an algorithm to be implemented.**
* Shortest code wins.
[**Related OEIS**](https://oeis.org/search?q=3814280&sort=&language=english&go=Search)
  
[Answer]
# [Jelly](http://github.com/DennisMitchell/jelly), 8 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ÆlÐĿĊḊi1
```
[Try it online!](http://jelly.tryitonline.net/#code=w4Zsw5DEv8SK4biKaTE&input=&args=MzgxNDI4MA) or [verify all test cases](http://jelly.tryitonline.net/#code=w4Zsw5DEv8SK4biKaTEKxbzDh-KCrEc&input=&args=MCwgMSwgMiwgMywgNCwgMTUsIDE2LCAzODE0Mjc5LCAzODE0Mjgw).
### Background
We start by successively taking natural logarithms of the input and the subsequent results until the result no longer changes. This works because the extension of the natural logarithm to the complex plane has a [fixed point](https://en.wikipedia.org/wiki/Fixed_point_(mathematics)); if **z = e-W(-1) ≈ 0.318 + 1.337i** – where **W** denotes the [Lambert W function](https://en.wikipedia.org/wiki/Lambert_W_function) – we have **log(z) = z**.
For input **n**, after computing **[n, log(n), log(log(n)), …, z]**, we first apply the ceiling function to each of the results. Jelly's implementation (`Ċ`) actually computes the imaginary part of *complex* number instead†, but we're not interested in these anyway.
Once the **k**th application of **log** yields a value less than or equal to **1**, `Ċ` will return **1** for the first time. The 0-based index of that first **1** is the desired result.
The straightforward implementation (compute 1-based index, decrement) fails because of edge case **0**, which does not have a **1** in its list of logarithms. In fact, for input **0**, the sequence of logarithms is
```
[0, None]
```
This is because Jelly's logarithm (`Æl`) is overloaded; it first tries `math.log` (real logarithm), then `cmath.log` (complex logarithm), and finally "gives up" and returns `None`. Fortunately, `Ċ` is similarly overloaded and simply returns it argument if it cannot round up or take an imaginary part.
Likewise, input **1** returns
```
[1, 0, None]
```
which may create problems in other approaches that do or do not involve `Ċ`.
One way to fix this problem is apply `Ḋ` (dequeue; removes first element) to the array of logarithms. This maps
```
0ÆlÐĿ -> [0, None]    -> [None]
1ÆlÐĿ -> [1, 0, None] -> [0, None]
```
so neither list has a **1** now. This way, finding the index of the first **1** will return **0** (not found), which is the desired output for inputs **0** and **1**.
### How it works
```
ÆlÐĿĊḊi1  Main link. Argument: n (non-negative integer)
  ÐĿ      Apply the following link until the results are no longer unique.
Æl          Natural logarithm.
          Return the array of all unique results.
    Ċ     Round all resulting real numbers up to the nearest integer. This takes
          the imaginary part of complex numbers and does nothing for non-numbers.
     Ḋ    Dequeue; remove the first item (n) of the array of results.
      i1  Find the first index of 1 (0 if not found).
```
---
† This is one of the only three atoms in Jelly that are overloaded in a non-obvious manner. 
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 9 bytes
```
Æl>1$Ð¿L’
```
[Try it online!](http://jelly.tryitonline.net/#code=w4ZsPjEkw5DCv0zigJk&input=&args=MzgxNDI4MA)
[Test suite.](http://jelly.tryitonline.net/#code=w4ZsPjEkw5DCv0zigJkKw4figqw&input=&args=WzAsMSwyLDMsNCwxNSwxNiwzODE0Mjc5LDM4MTQyODBd) (Slightly modified.)
### Explanation
```
Æl>1$Ð¿L’
     Ð¿    while loop, collect all intermediate results.
  >1$      condition: z>1
Æl         body: natural logarithm.
       L   length of the array containing all intermediate results,
           meaning number of iterations
        ’  minus one.
```
[Answer]
# Javascript, ~~45~~ ~~27~~ 26 bytes
```
l=a=>a>1&&1+l(Math.log(a))
```
[Here is test suite](https://repl.it/CdiG/3) (3rd rev)
Thanks @LeakyNun for saving 1 byte with conditional and then converting function to lambda, and @Neil for pointing out false is ok return value for <=1 (changed test to be == instead of ===)
[Answer]
# C, 38 bytes
```
f(double n){return n>1?1+f(log(n)):0;}
```
Pretty self-explanatory.
[Try it on ideone.](http://ideone.com/pGW2HR)
[Answer]
# Mathematica, 21 bytes
```
If[#>1,1+#0@Log@#,0]&
```
Recursive anonymous function. Takes an integer as input and returns its super-logarithm as output. Just uses the given definition.
[Answer]
# [Dyalog APL](http://goo.gl/9KrKoM), 13 [bytes](http://meta.codegolf.stackexchange.com/a/9429/43319)
Direct translation of OP:
```
{⍵≤1:0⋄1+∇⍟⍵}
```
[TryAPL](http://tryapl.org/?a=%7B%u2375%u22641%3A0%u22C41+%u2207%u235F%u2375%7D%A80%201%202%203%204%2015%2016%203814279%203814280&run) online!
[Answer]
# Pyth, 10 bytes
```
L&>b1hy.lb
```
[Test suite.](http://pyth.herokuapp.com/?code=L%26%3Eb1hy.lb%29y&test_suite=1&test_suite_input=0%0A1%0A2%0A3%0A4%0A15%0A16%0A3814279%0A3814280&debug=0)
This defines a function.
[Answer]
## Haskell, 23 bytes
```
l x|x>1=1+l(log x)|1<2=0
```
Usage example: `l 3814280` -> `4`.
[Answer]
# Python 3, 45 bytes
```
import math
s=lambda x:x>1and-~s(math.log(x))
```
For `x <= 1`, this returns `False` (which is `== 0` in Python).
[Answer]
## 05AB1E, ~~16~~ 13 bytes
```
[Dî2‹#¼žr.n]¾
```
**Explanation**
```
              # implicit input n
[          ]  # infinite loop
 Dî2‹#        # break if n rounded up is less than 2
      ¼       # else, increase counter
       žr.n   # set next n = log(n)
            ¾ # push counter and implicitly print
```
[Try it online](http://05ab1e.tryitonline.net/#code=W0TDrjLigLkjwrzFvnIubl3Cvg&input=MzgxNDI4MA)
[Answer]
# [J](http://jsoftware.com/), ~~21~~ ~~19~~ ~~18~~ 16 bytes
*Saved 2 bytes to Leaky Nun, 1 byte to Galen Ivanov, and 2 bytes to FrownyFrog!*
```
2#@}.(0>.^.)^:a:
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/jZQdavU0DOz04vQ046wSrf5rcilwpSZn5CukKRjAGIZwISMYwxjGMIErMoWzzOCqLAxNjCwM/gMA "J – Try It Online")
## Test cases
```
ls =: >:@$:@^.`0:@.(<:&1)
   ls 0
0
   ls 1
0
   ls 2
1
   ls 3
2
   ls 4
2
   ls 15
2
   ls 16
3
   ls 3814280
4
```
[Answer]
# [MATL](http://github.com/lmendo/MATL), ~~15~~ 12 bytes
```
0`ZetG>~}x@q
```
[Try it online!](http://matl.tryitonline.net/#code=MGBaZXRHPn59eEBx&input=MzgxNDI3OQ) Or [verify all test cases](http://matl.tryitonline.net/#code=YFhLeAowYFpldEs-fn14QHEKXURU&input=MAoxCjIKMwo0CjE1CjE2CjM4MTQyNzkKMzgxNDI4MA) (slightly modified version to handle several inputs).
### How it works
Starting with 0, apply iterated exponentiation until exceeding the input. The output is the number of iterations minus 1.
```
0       % Push 0
`       % Do...while loop
  Ze    %   Exponential
  t     %   Duplicate
  G     %   Push input
  >~    %   Is current value less than or equal to the input? If so: next iteration
}       % Finally (code executed at the end of the last iteration)
  x     %   Delete
  @q    %   Iteration index minus 1
        % Implicitly end loop
        % Implicitly display stack
```
[Answer]
# Julia, 17 bytes
```
!x=x>1&&1+!log(x)
```
[Try it online!](http://julia.tryitonline.net/#code=IXg9eD4xJiYxKyFsb2coeCkKCmZvciBuIGluIFswOjQ7IFsxNSwgMTYsIDM4MTQyNzksIDM4MTQyODBdXQogICAgQHByaW50ZigiJTdkIC0-ICVkXG4iLCBuLCAhbikKZW5k&input=)
[Answer]
# Java 7, 47 bytes
```
int c(double n){return n>1?1+c(Math.log(n)):0;}
```
[Try it online.](https://tio.run/##ZY/NCoJAEMfvPcXgaRdJ1KxMoZ7Ak8fosKnYmq7ijkKIz26rCSodf8P8vzLWsn0Wv4coZ1JCwLjodgASGfIIBi4QIhKXzTNPQNCuTrCpBYirdbP0iAQMX0ZepkRQ6pl@PyhppX6VdHZoSx5DoVxJiDUX6f0BjI4JAJhIJCb1F7DWYK/hsAZnozlu6LRRuZZjny9/J/eX2u@WpVPP6WOczOeK4UdiUhhlg0al2mMuCNc1DzS1ndPZpB@@)
The recursive Java 7 style method above is 2 bytes shorter than an iterative Java 8 style lambda:
```
n->{int c=0;for(;n>1;c++)n=Math.log(n);return c;}
```
[Try it online.](https://tio.run/##ZY/NjsIwDITvPIXFKVVF1fK3QFTeAC4cEYdsGthAcVDiIiHUZy9ptodWXCx9I894fBVPMbkWt0aWwjnYCY3vEYBGUvYspIJ9i0EAyQpT/ZYKMOJerEd@OBKkJewBIYcGJ9t32MxTfjaWcdxmXMZxhPlO0F9SmgvzZquosgiS1w1vQx4@1Yd0WU@jC7j7IuxAVuPleAIR/bcg5Yil4XoHWR@mfZj1YT7wLAa0HLhW2Xz6s/6SVunXz6Fn2Ghf1l3Fw8uRuiemouTh21OJTMfjDYxjTCTTURdTNx8)
**Explanation:**
```
int c(double n){      // Method with double parameter and integer return-type
  return n>1?         //  If the input is larger than 1:
    1+                //   Return 1 +
      c(Math.log(n))  //   A recursive call with log(input)
   :                  //  Else:
    0;                //   Return 0 instead
n->{                  // Method with double parameter and integer return-type
  int c=0;            //  Create a counter, starting at 0
  for(;n>1;           //  Loop as long as the input is still larger than 1:
    c++)              //   Increase the counter by 1
    n=Math.log(n);    //   And update the input to log(input)
  return c;}          //  After the loop: return the counter as result
```
[Answer]
# [Jelly](http://github.com/DennisMitchell/jelly), 8 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
-Ælß$Ị?‘
```
Straightforward implementation of the definition. [Try it online!](http://jelly.tryitonline.net/#code=LcOGbMOfJOG7ij_igJg&input=&args=MzgxNDI4MA) or [verify all test cases](http://jelly.tryitonline.net/#code=LcOGbMOfJOG7ij_igJgKxbzDh-KCrEc&input=&args=MCwgMSwgMiwgMywgNCwgMTUsIDE2LCAzODE0Mjc5LCAzODE0Mjgw).
### How it works
```
-Ælß$Ị?‘  Main link. Argument: x
     Ị    Insignificant; test if |x| ≤ 1.
      ?   If the result is 1:
-           Return -1.
          Else:
   $        Execute the monadic chain formed by the two links to the left.
Æl            Apply natural logarithm to x.
  ß           Recursively call the main link.
       ‘  Increment the result.
```
[Answer]
# MATLAB / Octave, 44 bytes
`function a=g(n);a=0;if n>1;a=1+g(log(n));end`
Tried to do it all as one anonymous function, but I forgot that MATLAB/Octave continues to evaluate expressions even if they are multiplied by a boolean false (zero) value:
`f=@(n)(n>1)*(1+f(log(n)))`
[Answer]
**Mathematica, 29 bytes** 
Simple as all hell, and works for comically large as well as negative inputs: 
```
f[x_]:=If[x>1,1+f[Log[x]],0]
```
[![enter image description here](https://i.stack.imgur.com/RQW7W.png)](https://i.stack.imgur.com/RQW7W.png)
[Answer]
# R, ~~38~~ 37 bytes
```
f=function(x)if(x>1)1+f(log(x))else 0
```
Thanks [@user5957401](https://codegolf.stackexchange.com/users/58162) for the extra byte!
Test cases:
```
> f(0)
[1] 0
> f(1)
[1] 0
> f(2)
[1] 1
> f(3)
[1] 2
> f(4)
[1] 2
> f(3814279)
[1] 3
> f(3814280)
[1] 4
```
[Answer]
# [R](https://www.r-project.org/), 34 bytes
```
f=pryr::f(`if`(n>1,1+f(log(n)),0))
```
[Try it online!](https://tio.run/##K/r/P822oKiyyMoqTSMhMy1BI8/OUMdQO00jJz9dI09TU8dAU/N/moaBJleahiGIMAIRxmCuKZg0AwtYGJoYmVvCmRYGmv8B "R – Try It Online")
A non-recursive approach is possible: **36** bytes and takes input from stdin.
```
n=scan()
while((n=log(n))>0)F=F+1
+F
```
[Answer]
## Emacs Lisp, 38 bytes
```
(defun l(n)(if(> n 1)(1+(l(log n)))0))
```
Testcases:
```
(mapcar 'l '(0 1 2 3 4 15 16 3814279 3814280))
;; (0 0 1 2 2 2 3 3 4)
```
[Answer]
## Perl 5, 35 bytes
Very simple, requires `-M5.016` (which is free) to enable the `__SUB__` keyword for anonymous recursion.
```
sub{$_[0]>1?1+__SUB__->(log pop):0}
```
Another alternative is
```
sub{$_[0]>1?1+__SUB__->(log pop):0}
```
which is 34 bytes, and gives the same output for all inputs > 1, but returns the special false value for inputs <= 1. False is numerically equal to zero, but prints as "" (empty string), so it probably doesn't qualify.
[Answer]
## CJam (16 bytes)
```
rd{_1>}{_ml}w],(
```
[Online demo](http://cjam.aditsu.net/#code=rd%7B_1%3E%7D%7B_ml%7Dw%5D%2C(&input=3814280)
Simple while loop with pre-condition. (What I really want here is a Golfscript-style unfold operation, but CJam doesn't have one, and floating point in GolfScript is messy and not at all golfy).
[Answer]
# [PARI/GP](http://pari.math.u-bordeaux.fr/), 24 bytes
Just the straightforward recursion.
```
f(n)=if(n>1,1+f(log(n)))
```
[Answer]
# Racket, 61 bytes
```
(λ(x)(letrec([a(λ(b)(if(> b 1)(+ 1 (a(log b)))0))])(a x)))
```
[Answer]
# Maple, ~~32,30~~ 29 bytes
```
f:=x->`if`(x>1,1+f(log(x)),0)
```
Test cases:
```
> f(0.);
  0
> f(1.);
  0
> f(2.);
  1
> f(3.);
  2
> f(4.);
  2
> f(3814279.);
  3
> f(3814280.);
  4
```
[Answer]
# R, 36 bytes
Slightly different approach from Plannapus
```
->n;a=0;while(n>1){a=a+1;n=log(n)};a
```
Uses a right assign to run the code -- so the desired number must precede it. i.e.
```
10->n;a=0;while(n>1){a=a+1;n=log(n)};a
```
[Answer]
# [Whispers v3](https://github.com/cairdcoinheringaahing/Whispers), 9 bytes
```
>> ln*(L)
```
[Try it online!](https://tio.run/##K8/ILC5ILSo2@v/fzk4hJ09Lw0fzv52CZ15BaQkXUMTwUccMIxDDv7QEKKRg/N/YwtDEyMIAAA "Whispers v2 – Try It Online")
Note that I had to [push a bug fix](https://github.com/cairdcoinheringaahing/Whispers/commit/9fb12f3ba8a5e1a7611fae2dfae5c9938345255e) in order to make this work. The `ln*` function had already been added [before September 1st 2020](https://github.com/cairdcoinheringaahing/Whispers/blob/81c0e41e8fe10fabfde713072cc6cd5e0e49290e/whispers%20v3.py#L2546), but I hadn't noticed a bug in the parsing that was fixed today
This is a function, going by the standards defined [here](https://codegolf.meta.stackexchange.com/a/20740/66833) for Whispers functions. It can be called by appending the code in the Footer to the file.
Whispers v3 also has the `slog`, `lg*` (uses \$\log\_2\$) and `log*` (uses \$\log\_{10}\$) functions
[Answer]
### Ruby, 29 bytes
```
l=->n{n<=1?0:1+l[Math.log n]}
```
[Answer]
# [Perl 6](http://perl6.org/), 21 bytes
```
{($_,*.log...1>=*)-1}
```
[Try it online!](https://tio.run/##JcVLDkAwFAXQrdxIIwgvnm@FdiuNgZoQwqgpa6@BMznncm1d2B1iCxV8Ikye0XasRMRaZWnBb7hnh0gYKA1vIcwbwR4XnqQkatIcz8QtuEMtuan64V@Wegwf "Perl 6 – Try It Online")
The parenthesized expression is a sequence. `$_`, the argument to the function, is the first element. `*.log` generates each successive element by taking the log of the previous element. The sequence continues until the ending condition, `1 >= *`, is true: 1 is greater than or equal to the current element. Subtracting 1 from the sequence coerces it to a number: its length.
]