[Question]
  [
Given a non negative integer number \$n\$ output how many steps to reach zero using radicals, divisions or subtractions.
# The algorithm
* Get digits count ( \$d\$ ) of \$n\$.
* Try the following operations in order:  
$$\sqrt[d]{n}$$
$$n/d$$
$$n-d$$
* Take the first integer result not equal to \$n\$.
Floating point errors must be avoided !
* Repeat the process with the value obtained until you reach 0.
# Example
1500 -> 8
```
1500 -> 4 digits , ( / ) => 375 // step 1
375 -> 3 digits , ( / ) => 125 // step 2
125 -> 3 digits , ( √ ) => 5 // step 3
5 -> 1 digits , ( - ) => 4 // step 4
4 -> 1 digits , ( - ) => 3 // step 5
3 -> 1 digits , ( - ) => 2 // step 6
2 -> 1 digits , ( - ) => 1 // step 7
1 -> 1 digits , ( - ) => 0 // step 8
```
**Input:** a non negative integer number. You don't have to handle inputs not supported by your language (obviously, abusing this is a [standard loophole](https://codegolf.meta.stackexchange.com/a/8245/66833))
**Output:** the number of steps to reach 0
# Test cases
```
n -> steps
0 -> 0
1 -> 1
2 -> 2
4 -> 4
10 -> 6
12 -> 7
16 -> 5
64 -> 9
100 -> 19
128 -> 7
1000 -> 70
1296 -> 7
1500 -> 8
5184 -> 8
10000 -> 133
21550 -> 1000
26720 -> 100
1018080 -> 16
387420489 -> 10
```
# Rules
* Input/output can be given by [any convenient method](http://meta.codegolf.stackexchange.com/q/2447/42963).
* You can print it to STDOUT, return it as a function result or error message/s.
* Either a full program or a function are acceptable.
* [Standard loopholes](http://meta.codegolf.stackexchange.com/q/1061/42963) are forbidden.
* Answers must not fail due to [floating point errors](https://codegolf.meta.stackexchange.com/q/20528/84844).
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so all usual golfing rules apply, and the shortest code (in bytes) wins.
---
Sandbox: <https://codegolf.meta.stackexchange.com/a/20518/84844>
  
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 19 16 bytes
*-3 thanks to @Unrelated String*
```
Ḋ|⟨ℕ{√₎|/|-}l⟩↰<
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFSu9qhtw6Ompoe7Omsfbp3w/@GOrppH81c8apla/ahj1qOmvhr9Gt3anEfzVwLV2fz/H22go2Coo2Cko2ACZIA4QKahmY6CGZgPFrAAs8BMS6CMoSmIbWpoAVEB4hgZmpqCKDNzI5AyA0MLAwsgw9jC3MTIwMTCMhYA "Brachylog – Try It Online")
A recursive function. If `n ≥ 10`, the three operations are tried. For `n < 10` we need `n` steps to `0`. With this we don't have to check that `step(n) ≠ n`, as it only occurs when there is one digit.
```
Ḋ|⟨ℕ{√₎|/|-}l⟩↰<
Ḋ                if n is in 0…9, return n
 |               otherwise
  ⟨f    h   g⟩   [f(n), g(n)] h
   ℕ        l    [n, digits] and n is a natural number
    {√₎|/|-}     try (root, divide, subtract) one after the other
                 (results that are not natural numbers will
                  get filtered in the next step with ℕ)
              ↰  recurse
               < get a number that is strictly larger, thus +1
```
[Answer]
# [R](https://www.r-project.org/), ~~77~~ ~~74~~ 73 bytes
-3 bytes thanks to Giuseppe and -1 byte thanks to MarcMush.
```
f=function(n,d=nchar(n),k=1:n)`if`(d<2,n,1+f(match(n,c(k^d,k*d,k+d))%%n))
```
[Try it online!](https://tio.run/##JY1hasMwDEb/5xQioyC1Glhukrpj6UlKaXBqatKpkHjnz@xMIPSe9IHmdQ19@FWf4ltReezVP4cZlXjq5UvpHsMdx2/LynII@DMk/8w5j9Nt5Gmf@zAS7XZKtAYUk4uq6gOG1wvSY0ngh@WxVAo9eDQMwmAZmgxFMkrH0G2@LdxGG57zRdrCrbj/RBErbVtGd7IlZsQZl@HoTo01jTtTFd4zRogKSvl9wshQf15qhoCRuL5qTesf "R – Try It Online")
Recursive function; avoids floating point issues. The vector `k` contains all integers from `1` to `n`. Concatenate `k^d`, `k*d` and `k+d` (yielding a vector of length `3n`) and find the position `p` of the first occurrence of `n`. Then \$f(n)=1+f(p \mod n)\$. The recursion is initialized by noting that \$f(n)=n\$ for all 1-digit integers (hence the conditioning on `d<2`).
Works for all the test cases (although `21550` could require you to increase the stack limit on some machines).
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), ~~40~~ ~~36~~ 32 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?") ([SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set"))
-6 thanks to ovs.
Anonymous tacit prefix function. Requires zero-based indexing (`⎕IO←0`).
```
0∘{×⍵:(1+⍺)∇⊃⍵(…⍤⊣∩√⍨,÷,-)≢⍕⍵⋄⍺}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/3@BRx4zqw9Mf9W610jDUftS7S/NRR/ujrmaggMajhmWPepc86lr8qGPlo45Zj3pX6BzerqOr@ahz0aPeqUAVj7pbgDpq/6c9apvwqLcPrG3No94th9YbP2qb@KhvanCQM5AM8fAM/p@mYMCVpmAIxEZAbAJigwVAPEMzIGEGEYMIWkDYEI4lSNrQFMwzNbSAqgNzjQxNTcG0mbkRWLGBoYWBhQHXo965CmkKxhbmJkYGJhaWCiB@UWphaWZRarFCbn5RqkJuKpCqVCjJSMxTCPH0V0jMyclPTixJLQYA "APL (Dyalog Extended) – Try It Online")
`0∘{`…`}` "dfn" bound with 0 as left argument (`⍺`, initial step count ― right argument, \$n\$ is `⍵`):
 `×⍵:` if \$n>0\$ (lit. "if \$\text{sgn}(n)\$")
 `⍕⍵` stringify \$n\$
 `≢` tally the number of characters (digits)
 `⍵(`…`)` apply the following tacit function to that, with \$n\$ as left argument:
  `√⍨` \$\root d\of n\$
  `,` followed by
  `÷` \$\frac nd\$
  `,` followed by
  `-` \$n-d\$
  `∩` intersection of that and
 `⍳⍤⊣` \$\{1,2,3,…,n-1\}\$
`⊃` the first element
 `(`…`)∇` recurse on that, with the following as new left argument:
  `1+⍺` one plus the current step count
---
If `d←≢⍕⍵` we have the expression `⍵(⍳⍤⊣∩√⍨,÷,-)d` which could be written in traditional mathematical notation as:
$$\{1,2,3,…,n-1\}∩\Big\{\root d\of n,\frac nd,n-d\Big\}≡\Big\{\root d\of n,\frac nd,n-d\Big\}\setminus\{n\}$$
[Answer]
# JavaScript (ES7), ~~73~~ 68 bytes
```
f=n=>(d=(n+'').length)<2?n:1+f((k=n**(1/d)+.5|0)**d-n?n%d?n-d:n/d:k)
```
[Try it online!](https://tio.run/##fdHNboMwDAfw@56Cy9QEBDghCQGN8SxVA/1CpmqrnvbubJXoVBuJXH9/20l82j62t931eLmnOIZumvoGm28RGoHJZiOzocP9/SC/dIu1Snohzg3GsVB5kElmf0DGcUixxc/QYhpqzEN9ltNuxNs4dNkw7kUvIJqPlFGeR/BBWVFWjDVlzdhQNrw5EHacNeGSsyNsGTtDuFrMBvKwhWu/Ohzm@pkX/6Yrt1ZuSblnbJU3K/wcDm93Lwq@FmXte@AvzhOu1DSxmKE8ePgP8OUUvjQajK9eDaZf "JavaScript (Node.js) – Try It Online")
Or [60 bytes](https://tio.run/##Zc/NDoIwEATgu0/RC2EXAv0JYiDWPguhgArZGiG@fr142TrXL5nJPIfPsI/vx@uoKPgpxtmSvYG3QGWeY71NtBx3vBpHvS5ngNVSUYCWHjHTjjLvqPI9Sd@vGMdAe9imegsLzKDEL4hCSqFOnDVnnbDhbBJuODdpuWLcpmwYX1JuGZ8TbhvG3d@2Yse6@AU) if floating point errors are acceptable.
### Commented
```
f = n =>                 // f is a recursive function taking the input n
  (d = (n + '').length)  // d is the number of digits in n
  < 2 ?                  //   if there's only one digit:
    n                    //     stop the recursion and return n
                         //     (because only n - 1 is valid at this point)
  :                      //   else:
    1 +                  //     increment the final result
    f(                   //     and do a recursive call:
      (                  //
        k = n ** (1 / d) //       define k as the d-th root of n
        + .5 | 0         //       rounded to the closest integer
      )                  //       
      ** d - n ?         //       if k ** d is not equal to n:
        n % d ?          //         if d is not a divisor of n:
          n - d          //           use n - d
        :                //         else:
          n / d          //           use n / d
      :                  //       else:
        k                //         use k
    )                    //     end of recursive call
```
[Answer]
# [Python 3.8](https://docs.python.org/3.8/), ~~112~~ \$\cdots\$ ~~97~~ 96 bytes
Saved ~~7~~ a whopping 15 bytes thanks to [Arnauld](https://codegolf.stackexchange.com/users/58563/arnauld)!!!  
Saved a byte thanks to [Danis](https://codegolf.stackexchange.com/users/99104/danis)!!!
```
f=lambda n:n and-~f([t:=round(n**(1/(d:=len(str(n))))),n//d,t,n-d][(t**d!=n)+2*(n%d>0)|3*(d<2)])
```
[Try it online!](https://tio.run/##NZBNbsMgEIX3PsV0URkc0gD@jVXnImkWqcGK1QRbQBZRml7d9eBkJMR7j0@jYcabPw0mrUY7TV1zPl6@1RFMbeBo1PqvI3tfN3a4GkVMkhCxIapuztoQ5y0xFIuZzUYxz8xaHfbEJ4l6awxdyYSYd7Xj9DdNiPqU9ECn/jIO1oO7uWg@H057q9urdf1gzv2l90TkfC4aee28gwYI4Qw4ZUAEA4G3ZCDxzhhkIZ@BIoj5pQyiYJCjKGZmuzAzJBYpqxfGMS2X5nJbvOIc4wplLqrsKRHGHmkaZhB5jg5HRVuUcrELKipeoQ9jpVWZSZ5VWwQojdqTbn@0xb/FX1dZZm0MQYg0plE3WPBMQ28grKCOYC7cREc8XfFgR9sbT7r47h@w3sHdPeD@bLvXTeMOj5hO/w "Python 3.8 (pre-release) – Try It Online")
[Answer]
# [Julia 0.7](http://julialang.org/), ~~68~~ ~~62~~ 57 bytes
inspired by [Robin's answer in R](https://codegolf.stackexchange.com/a/215946/98541)
```
!n=n>0&&1+!filter(r->n∈((d=ndigits(n))r,r+d,r^d),0:n)[]
```
[Try it online!](https://tio.run/##bY9NasMwEIX3OsXElCARFST5Ty7YF0lTKJUcZIwaZBV6hOwLXfV0uYirnxi6qEDMe0@fhpnpYzav7brubG8Htt/zw240s9cOu8fB3q5XjFVvlTkbv2BLiKPuoKh7UYSyJ0uOp9XrxS/QwxEx6AdgFPFYOUUiVkFRFWsV8gQ0QaSXNogmipqiJjFdZBLEoxRyw1hO29hcdM0W1zmWFNVcVncZ4dyjLMMMvK6zC2mwTSs2G1Eumcw@jFXKthKskl0GKDohNL47wIZOBIyFtCqCcEYTNt6ZpM2YbA9TsvFcnLF@tri4/XxBQcHEjqMhCdDzov8jv/@QFIpnj/XnRb95reBhIsX9s1Uo3PUX "Julia 0.7 – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 19 bytes
```
*,×;+
ç€DL$œi⁸ḢµƬTL
```
[Try it online!](https://tio.run/##y0rNyan8/19L5/B0a22uw8sfNa1x8VE5OjnzUeOOhzsWHdp6bE2Iz//D7UDx//8NdBQMdRSMdBRMgAwQB8g0NNNRMAPzwQIWYBaYaQmUMTQFsU0NLSAqQBwjM3MjAwA "Jelly – Try It Online")
## How it works
```
*,×;+ - Helper link. Takes two integers k and d on the left and right
*     - k * d
  ×   - k × d
 ,    - [k * d, k × d]
    + - k + d
   ;  - [k * d, k × d, k + d]
ç€DL$œi⁸ḢµƬTL - Main link. Takes n on the left
         µ    - Group the previous links into a monad f(n):
    $         -   To n:
  D           -     Cast to digits
   L          -     Length
 €            -   Over each k = 1, 2, 3, ..., n:
ç             -     Call the helper link with k on the left and the digit length on the right
       ⁸      -   n
     œi Ḣ     -   Find the index of the first triple containing n
          Ƭ   - Until reaching a fixed point, repeatedly apply f(n)
                Both 1 and 0 are fixed points of f(n)
                As Ƭ returns [n, f(n), f(f(n)), ..., 1] for n > 0
                and [0] for n = 0, 1 being a fixed point offsets the 
                included n at the start. However, taking the length here
                would return 1 for n = 0 instead of 0
           T  - Find the indices of non-zero elements. As every element
                is non-zero unless n = 0, this yields [1, 2, ..., l]
                for n > 0 and [] for n = 0, where l is the output
            L - Length
```
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 134 bytes
```
.+
,$&,$&$*
+`,(.)*,(1*?)((?=\2+$)(?<=(?=(?<-1>(?=((1*)(?=\2\5+$)1)(\4*$))\6)+1$)\2).*|(?<-1>)(?<-1>\2)+|(?<-1>1)+)$(?(1)1)
1,$.2,$2
1
```
[Try it online!](https://tio.run/##LYsxDsIwDEV3n8Mg/yREddRGRaJk5BIZysDAwoAYuXtwWiRL//k/@/34PF/3dpDb2qKnwEcbduTXIBEuiLoCkbLU5BlSLouxxUmvHUxjk3UyrZA6OgZqhldGTYjuu19jD6v8v1F4sBRR@yMNHFPgRNraQEqJRlIDKzLlzn2Ze3Y4Z9LJaNJ5c8PwAw "Retina 0.8.2 – Try It Online") Link includes faster test cases. Explanation:
```
.+
,$&,$&$*
```
Create a working area consisting of the result (initially 0), the input, and the input converted to unary.
```
+`
```
Repeat until the input has been reduced to zero ...
```
,(.)*,(1*?)(
```
count the number of digits `d` in the value `n`, and then find the smallest value that satisfies one of ...
```
(?=\2+$)(?<=(?=(?<-1>(?=((1*)(?=\2\5+$)1)(\4*$))\6)+1$)\2).*|
```
... its `d`th power is `n`, or ...
```
(?<-1>)(?<-1>\2)+|
```
... its product with `d` is `n`, or ...
```
(?<-1>1)+)
```
... its sum with `d` is `n`, and ...
```
$(?(1)1)
```
ensure that it was in fact `d` and not some smaller integer, and ...
```
1,$.2,$2
```
increment the output and replace `n` and its unary with the result.
```
1
```
Convert the output to decimal.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 39 bytes
```
[D0Q#DUgVXYzmXY/XY-).Δ©D2.òsòQ®XÊ&}ò¼}¾
```
[Try it online!](https://tio.run/##AT4Awf9vc2FiaWX//1tEMFEjRFVnVlhZem1YWS9YWS0pLs6UwqlEMi7DsnPDslHCrljDiiZ9w7LCvH3Cvv//MTUwMA "05AB1E – Try It Online")
Why can't you try it online? Because there's a bug with the TIO where raising numbers to floats which are actually whole numbers runs infinitely.
## Explained
```
[D0Q#DUgVXYzmXY/XY-).Δ©D2.òsòQ®XÊ&}ò¼}¾
[                                           # Start an infinite loop with the input already on the stack.
 D0Q#                                       #   End the loop if the result from two lines above is 0
     DU                                     #   Store the top of the stack in variable X
       gV                                   #   And store its length in variable Y
         XYzm                               #   Push the Yth root of X
             XY/                            #   Push X / Y
                XY-                         #   Push X - Y
                   )                        #   And wrap that into a list
                    .Δ                      #   From that list, get the first item where:
                      ©D2.ò                 #       The item, when rounded to 2 decimal places
                           sòQ              #       Equals the item rounded to the nearest integer
                              ®XÊ&          #       And where it doesn't equal variable X
                                  }         #
                                   ò        #   Round that result to the nearest integer
                                    ¼}      #   Increment the counter variable, which keeps track of how many iterations we've gone through
                                      ¾     # Push the counter variable and implicitly print
                  
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~34~~ 31 bytes
```
⊞υＮＷ⌊υ⊞υ⌊Φι№⟦ＸκＬι×κＬι⁺κＬι⟧ιＩ⊖Ｌυ
```
[Try it online!](https://tio.run/##XY09CwIxEER7f8WWG4hwFlaWJ4KgksJOLM5zMYv5kFzW@/kxitdcMzCPx0xvu9THzpViZLAoGvbhJfkk/kYJldosRsuOAI8c2ItHUQomdWI7drnarKGNEjJeTBxrf2o4UHhki6yUhjN7GubQOJmxq4aa32eTuI613ZBxS30iTyHTHf@q/KRSVuumKcu3@wA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
⊞υＮ
```
Input `n` and push it to the predefined empty list.
```
Ｗ⌊υ
```
Repeat until the list contains zero.
```
⊞υ⌊Φι№⟦ＸκＬι×κＬι⁺κＬι⟧ι
```
For all integers less than `n`, take the `d`th power and the product and sum with `d`, and push the lowest integer where one of the results is `n` to the list.
```
Ｉ⊖Ｌυ
```
Output the final number of iterations, which is one less than the length of the list.
[Answer]
# [C (gcc)](https://gcc.gnu.org/) with `-lm`, ~~121~~ 120 bytes
* -1 thanks to ceilingcat
To get the number of digits, I used the floor of `log10+1` of the value. Each iteration runs through the operations until the result is an integer that doesn't match the current value; when the result is `0` the number of steps is returned.
```
f(i,c,o,l){float a;for(c=0;i;i=a,c++)for(o=0,l=log10(i)+1,a=.1;fmod(a,1)||a==i;)a=o++?o>2?i-l:(i+0.)/l:pow(i,1./l);i=c;}
```
[Try it online!](https://tio.run/##JU/NcsIgEL7zFDvt2IEJiYD5U0p8kV4oMYqDwTGxHtRXb7qxB2a/3wVcundumjrqueORB3bvQrQjWN3FC3VGaK@9sdwlCZuVaAQPJsS9FNSzRHJrMqm7U2yp5ZI9HtYYr5k1MUm2sVFbn4YN9YnI2DJszvGGF8lsGRhudfo5vfvehWu7g89hbH3MDg0hvh/hZH1Pf6JvGdwJwCx5ftQE8fwMDYOzfUffFi0s2q/@jcOHx3NkjdQMQwDnC5b@E6bBEAzj7jwAHQ7xGlr43qHGXk0s4v8ZhyPT5DkJEESCJAoUySEnUkBJpIKKyBIKUuawRk2AxKHqWRbIKiypdTnTAmlNClnnOGYTs6sVUbIoECElqqzUC6Ita1EjLsmqrnIl8nqNxq/rgt0PUxpOU3r7Aw "C (gcc) – Try It Online")
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 47 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
Çƒô▄↑"è≈■É↑├µxαêöV*┐┘ÆwaYM╙¿9⌠╛o-ºtΓ⌡╔ΔZj♦○Qæº`
```
[Run and debug it](https://staxlang.xyz/#p=809f93dc18228af7fe9018c3e678e08894562abfd9927761594dd3a839f4be6f2da774e2f5c9ff5a6a04095191a760&i=1500&m=2)
Accomodates for floating point innacuracies.
## Explanation
`,` put input on main stack
`{...w` loop till falsy value
`X` store current interation in register X
`c$%` get number length
`bbbb` duplicate number 4 times
`u#aa` get floating point root
`|N` get integer root
`-Au<{sd}{d}?~` if difference < 0.1, take the integer root otherwise float
`/~` get n/d
`-~` get n-d
`Lr` convert all those to array, reverse
`{...}j` find first value which satisfies:
`cx=!` not equal to current iteration
`_c1u*@=*` and not equal to its floor
`ciYd` save iteration index in Y
`y^` output final index
[Answer]
# [Add++](https://github.com/cairdcoinheringaahing/AddPlusPlus), 82 bytes
```
D,f,@,BDbLddARdV$€*$G$€+@G$€Ω^BcB]A€ΩedbLRz£*bUBZ@B]A$þ=bU
x:?
Wx,`x,$f>x,`y,+1
Oy
```
[Try it online!](https://tio.run/##S0xJKSj4/99FJ03HQcfJJcknJcUxKCVM5VHTGi0VdxCl7QCmzq2Mc0p2inUEM1NTknyCqg4t1koKdYpyAIqqHN5nmxTKVWFlzxVeoZNQoaOSZgekK3W0Dbn8K////29oamAAAA "Add++ – Try It Online")
]