[Question]
  [
# Task:
**Given an integer number in decimal number system, reduce it to a single decimal digit as follows:**
1. Convert the number to a list of decimal digits.
2. Find the largest digit, D
3. Remove D from the list. If there is more than one occurrence of D, choose the first from the left (at the most significant position), all others should remain intact.
4. Convert the resulting list to a decimal number and multiply it by D.
5. If the number is bigger than 9 (has more than 1 decimal digit), repeat the whole procedure, feeding the result into it. Stop when you get a single-digit result.
6. Display the result.
Example:
```
26364 -> 
1. 2 6 3 6 4 
2. The largest digit is 6, so D=6
3. There are two occurrences or 6: at positions 1 and 3 (0-based). We remove the left one,
    at position 1 and get the list 2 3 6 4 
4. we convert the list 2 3 6 4 to 2364 and multiply it by D:
   2364 * 6 = 14184
5. 14184 is greater than 9 so we repeat the procedure, feeding 14184 into it.
```
We continue by repeating the procedure for 14184 and so on and we go through the following intermediate results, finally reaching 8:
```
11312
3336
1998
1782
1376
952
468
368
288
224
88
64
24
8
```
So the result for 26364 is 8.
**Input:** An integer / a string representing an integer
**Output:** A single digit, the result of the reduction applied to the number.
**Test cases:**
```
9 -> 9
27 -> 4
757 -> 5
1234 -> 8
26364 -> 8
432969 -> 0
1234584 -> 8
91273716 -> 6
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answers in bytes in each language win.
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 6 bytes
### Code:
```
[Dg#à*
```
Uses the **05AB1E** encoding. [Try it online!](https://tio.run/##MzBNTDJM/f8/2iVd@fACrf//LQ2NzI3NDc0A "05AB1E – Try It Online")
### Explanation
```
[Dg#     # While the length of the number is not 1
    à    # Extract the largest element from the current number
     *   # Multiply it with the leftover number
```
[Answer]
# JavaScript (ES6), 49 bytes
```
f=n=>n>9?f(""+n.replace(m=Math.max(...n),"")*m):n
```
Takes input as a string representation of an integer, like `f("26364")`.
## Test Cases
```
f=n=>n>9?f(""+n.replace(m=Math.max(...n),"")*m):n
;["9", "27", "757", "1234", "26364", "432969", "1234584", "91273716"]
.forEach(num => console.log(num + " -> " + f(num)))
```
```
.as-console-wrapper{max-height:100%!important}
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 13 bytes
```
œṡṀẎḌ×ṀD
DÇḊ¿
```
[Try it online!](https://tio.run/##y0rNyan8///o5Ic7Fz7c2fBwV9/DHT2HpwOZLlwuh9sf7ug6tP////@WhkbmxuaGZgA "Jelly – Try It Online")
-1 thanks to a trick I found in Jonathan Allan's [answer](https://codegolf.stackexchange.com/a/148515/41024).
Full program.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 16 bytes
```
.WtH`*s.-ZKeSZsK
```
Takes input as a String. **[Try it here!](https://pyth.herokuapp.com/?code=.WtH%60%2as.-ZKeSZsK&input=%221234584%22&debug=0)** (Alternative: `.WtH`*s.-ZeSZseS`)
# [Pyth](https://github.com/isaacg1/pyth), 18 bytes
```
.WgHT*s.-`ZKeS`ZsK
```
Takes input as an integer. **[Try it here!](https://pyth.herokuapp.com/?code=.WgHT%2as.-%60ZKeS%60ZsK&input=1234584&debug=0)**
### How it works
**16-byter**
```
.WtH`*s.-ZKeSZsK ~ Full program.
.W               ~ Functional while. While A(value) is truthy, value = B(value).
                 ~ The final value is returned.
  tH             ~ A, condition: Is value[1:] truthy?  Is the length ≥ 2?
    `*s.-ZKeSZsK ~ B, setter.
       .-        ~ Bagwise subtraction, used for removing the highest digit, with...
         Z       ~ The current value Z, and...
          KeSZ   ~ The highest digit of Z (as a String). Also assigns to a variable K.
      s          ~ Casted to an integer.
     *           ~ Multiplied by...
              sK ~ The highest digit.
    `            ~ Convert to a String.
```
**18-byter**
```
.WgHT*s.-`ZKeS`ZsK ~ Full program.
.W                 ~ Functional while. While A(value) is truthy, value = B(value).
                   ~ The final value is returned.
  gHT              ~ A, condition: is value (H) ≥ 10?
     *s.-`ZKeS`ZsK ~ B, setter.
       .-          ~ Bagwise substraction (used for removing first occurrence).
         `Z        ~ The string representation of Z.
           KeS`Z   ~ And the highest (lexicographically) character of Z (highest digit).
                     It also assigns it to a variable called K.
      s            ~ Cast to integer.
     *             ~ Multiply by...
                sK ~ K casted to int.
```
Being *that close* to Jelly at such type of challenge is very good for Pyth IMO :-)
[Answer]
# [Husk](https://github.com/barbuz/Husk), ~~14~~ ~~13~~ 12 bytes
Thanks Zgarb for saving 1 byte.
```
Ω≤9oṠS*od-▲d
```
[Try it online!](https://tio.run/##yygtzv6vcGhb7qOmxv/nVj7qXGKZf2i51qNpm/JTHu5coAtkpPz//z/aUsfIXMfc1FzH0MjYRMfIzNjMRMfE2MjSzBIsYmphomNpaGRubG5oFgsA "Husk – Try It Online")
### Explanation:
```
Ω≤9            Repeat the following function until the result is ≤ 9
           d     Convert to a list of digits
         -▲      Remove the largest one
       od        Convert back to an integer
   oṠS*          Multiply by the maximum digit
```
[Answer]
# [R](https://www.r-project.org/), ~~99~~ 95 bytes
```
f=function(x)"if"(n<-nchar(x)-1,f(10^(n:1-1)%*%(d=x%/%10^(n:0)%%10)[-(M=which.max(d))]*d[M]),x)
```
[Try it online!](https://tio.run/##JcjtCoIwFIDhexEG58hZuQ@3FnkJXoEYyGQo2BIrWle/pP6977PlHJrwiv453yMkLOZQQLzw6Kdh258LCiCqK8Sz4AJZyWBsEjuyv1XI9sKOQ9u8p9lPh9uQYETsy7Fre6SE@TGs6/IBD46kJVtbElJpkkYZTVpJZ9xP6pMmJ6RVVhikgPkL "R – Try It Online")
A recursive function. Adding `f(number)` in the footer can be used to test for other values of `number`. Straightforward implementation, `d` is the list of digits, and `10^(n:2-2)%*%d[-M]` computes the number with the largest digit removed.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 59 bytes
```
f=->n{m=n.digits.max;n>9?f[n.to_s.sub(m.to_s,"").to_i*m]:n}
```
[Try it online!](https://tio.run/##JYjRDoIgGEZf5R@bWzVkAxSipj0IY00zywuohWw19dkJ6@Y75zuv0H5i7Ku8dpOtHOmG2zB6Ypv30dXq1GtHxsfZEx/ajf0pRmi7yrCz5uCWqBUGJjHIMg1lvEhXcJFQcKaE@sdyn4KiTHJJhSHX5nKHCWYX7AzPMHpAWQd5DVmHIAOdOoZ@hTGwxC8)
Recursive lambda function called like `f[26364]`.
[Answer]
# [Python 2](https://docs.python.org/2/), 72 bytes
```
f=lambda n:`n`*(n<=9)or f(int(`n`.replace(max(`n`),'',1))*int(max(`n`)))
```
**[Try it online!](https://tio.run/##K6gsycjPM/r/P802JzE3KSVRIc8qIS9BSyPPxtZSM79IIU0jM69EAyikV5RakJOYnKqRm1gB4mvqqKvrGGpqaoHkYWKamv8LikACaRqWhkbmxuaGZkAhAA "Python 2 – Try It Online")**
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 15 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
D×Ṁ$œṡṀ$FḌµ>9µ¿
```
**[Try it online!](https://tio.run/##y0rNyan8/9/l8PSHOxtUjk5@uHMhiOH2cEfPoa12loe2Htr///9/IzNjMxMA "Jelly – Try It Online")** or see the [test-suite](https://tio.run/##y0rNyan8/9/l8PSHOxtUjk5@uHMhiOH2cEfPoa12loe2Htr//3D7o6Y1//9HW@ooGJnrKJibAglDI2MTINfM2AxImRgbWZpZQgRNLYACloZG5sbmhmaxAA "Jelly – Try It Online").
### How?
```
D×Ṁ$œṡṀ$FḌµ>9µ¿ - Link: number, n
              ¿ - while:
             µ  - ...condition (monadic):
            9   -    literal 9
           >    -    loop value greater than (9)?
          µ     - ...do (monadic):               e.g. 432969
D               -    convert to a decimal list        [4,3,2,9,6,9]
   $            -    last two links as a monad:
  Ṁ             -      maximum                         9
 ×              -      multiply (vectorises)          [36,27,18,81,54,81]
       $        -    last two links as a monad:
      Ṁ         -      maximum                         81
    œṡ          -      split at first occurrence      [[36,27,18],[54,81]]
        F       -    flatten                          [36,27,18,54,81]
         Ḍ      -    convert from base 10              389421  (i.e. 360000 + 27000 + 1800 + 540 + 81)
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~70~~ ~~67~~ 66 bytes
Saved ~~3~~ 4 bytes thanks to nimi!
```
f x|x<10=x|(a,b:c)<-span=<<(>).maximum$show x=f$read[b]*read(a++c)
```
[Try it online!](https://tio.run/##HchLDoIwFADAq3TBopUnsR9ba1pv4AkIMQ@EQKRIQGMX3L1GV5NMj@ujHceUOhK36PjBx40i1OeGuf064@SdoxdWBIxDeIds7Z8fEn2XLS3ey7ra/aSY5w1LAYeJeBJwvt4InZdhehUdI6UFYcAcDXAhFQgttQIlhdX2P8eTAsuFkYbrKn0B "Haskell – Try It Online")
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), 126 bytes
```
int F(int n){var x=(n+"").ToList();var m=x.Max();x.RemoveAt(x.IndexOf(m));return n>9?F(int.Parse(string.Concat(x))*(m-48)):n;}
```
[Try it online!](https://tio.run/##fY9RS8MwFIWfm19x2VOiNHNt1y6WTUQYCBsOFXwQH0IXR2BNMMlGZey318RO3IP2JeS759xz761sXGkj2p2VagNPn9aJukTnRBdSfZQIVVtuLayM3hhewwFF1nEnK9hruYYllwpbZ3zb6xtws7EEDq1UDuY4vIoc9txAM8XqcjAg9FkvpHWYlKFaTxu65I2nhj6KWu/FrcMNvVdr0Ty845qQ0gi3MwrUjN18B9IVN1acJtI7rSruWwi5wHWcTQi5VuWxjSIvWL0V9MVIJ/wdAs8x83Hobykp/teKcY84StKsJzZP8x45SxOWs/7w8aQngI2SIi1GeXAg7xkOgUE8A9b9kyJA1oE/I9C4oxAdcHJyhkXPuNssFK5@/X6VM8vP7FDKUXREx/YL "C# (.NET Core) – Try It Online")
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), ~~36~~ ~~35~~ 33 bytes
-1 due to updated OP specs. -2 thanks to ngn.
Anonymous tacit prefix function. Takes integer as argument.
```
{⍵>9:∇(⌈/×10⊥⊂⌷⍨¨⍳∘≢~⊢⍳⌈/)⍎¨⍕⍵⋄⍵}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24TqR71b7SytHnW0azzq6dA/PN3Q4FHX0kddTY96tj/qXXFoxaPezY86ZjzqXFT3qGsRiANUpfmotw8kMxWo@VF3C5CsBZp2aIWlgpG5grmpuYKhkbGJgpGZsZmJgomxkaWZJVjE1MJEwdLQyNzY3NAMAA "APL (Dyalog Unicode) – Try It Online")
`{`…`}`a function where `⍵` is the argument:
 `⍵>9:` if the argument is greater than 9, then:
  `⍕⍵` format (stringify) the argument
  `⍎¨` execute (evaluate) each (this gets us the digits as numbers)
  `(`…`)` apply the following tacit function on those
   `⌈/` the largest digit
   `×` times
   `10⊥` the base-10 decoding of (collects digits)
   `⊂` all the digits
   `⌷⍨¨` indexed by each of
   `⍳∘≢` the **i**ndices of the number of digits
   `≠` differs from
   `⊢⍳⌈/` the largest digit's **i**ndex in the entire list of digits
  `∇` recurse (i.e. call self) on that
 `⋄` else
  `⍵` return the argument unmodified
[Answer]
# [Perl 6](https://perl6.org), ~~45~~ 41 bytes
```
{($_,{$/=.comb.max;S/"$/"//*$/}...10>*).tail}
```
[Test it](https://tio.run/##TY5Pa4QwEMXv8ykGCUVdm6xRoxJceu25PRYWqykI/mONZYv4yXrrF7ObVMqe5s1778fMqC6t2OZJ4aeglYTuCx@qoVZYbItLzsFCWEGroXunXXmVL8whzGHMJ2yllIbHk@9RXTbtut3AJ60mjQW2Ta8m1/v5tqDL3uoDM9tzryWYU6@3noSxLXs8WEjCx3DZ@ccTuqTpx1kHSNR1VJVWtYcLIDYTmt/22LvLA3T@TIP/uw6sW26cHHhqZgxpYkUCIY9iozLgIhK7jCOeC0scbSHJ9iAPeRqloTCb@AU "Perl 6 – Try It Online")
```
{($_,{S/"{.comb.max}"//*$/}...10>*).tail}
```
[Test it](https://tio.run/##TY5PC4JAEMXv8ykGkdCy3Vx1TaTo2rmOQZhuIPiP3KIQP1m3vpi1m0SnefPe@zHTiEvBh2sr8MZJGkP5wElaZwJXQ2eZR6fbUaMjaV2eSJnce4PSqUl7Qoi7WE9tIpO86IcPtJGilbjCIq9Ea9mvp2YseshmVG3bSsagzuw/vRiaIqlwpqEYzvVl5OdrtMy8aq7SQVPcG5FKkdnYAWLeovprjO2/3EHjayr85xrQD5FyImChmj6EgRYBuMzzlVoC4x4fpe@xiGtioQvBcgwil4Ve6HK18Tc "Perl 6 – Try It Online")
## Expanded:
```
{  # bare block lambda with implicit parameter ｢$_｣
  (  # generate the sequence
      $_,                      # start the sequence with the input
      {                        # generate the rest of the values in the sequence
          S/                   # find and replace (not in-place)
            "{  .comb.max  }"  # find the max digit and match against it
          //                   # replace it with nothing
          *                    # multiply the result with
          $/                   # the digit that was removed
      }
      ...                      # keep generating values until
      10 > *                   # the value is less than 10
  ).tail                       # get the last value from the sequence
}
```
[Answer]
# [Retina](https://github.com/m-ender/retina), 67 bytes
```
{1`(..+)?
1$&;$&
O`\G\d
.+((.);.*?)\2
$1
\d+
$*
1(?=.*;(1+))|.
$1
1
```
[Try it online!](https://tio.run/##FckxCoUwEAXA/p0jym4CCxv9BgmS0tILpIighY3Fx07vHnHa@e/Xca61obnUWwuJOE5Q00bTYil5zhvEEQlHsYmzh1HkzcFYKKVJbCR1zI98obWO8AHhF6C@6@GHbuhf "Retina – Try It Online") Link includes the test cases fast enough not to hammer Dennis's server. Explanation:
```
{1`(..+)?
1$&;$&
```
For two digit numbers, this duplicates the number with a `;` separator, prefixing a 1 to the duplicate. For one digit numbers, this prefixes `1;` to the number.
```
O`\G\d
```
Sort the digits of the duplicate. (For one digit numbers, this has no effect.)
```
.+((.);.*?)\2
$1
```
Find the first occurrence of the largest digit, and delete it, and also the other digits in the duplicate, and the extra 1 that was added earlier. (For one digit numbers, the match fails so this does nothing.)
```
\d+
$*
1(?=.*;(1+))|.
$1
1
```
Multiply the number by the digit. For one digit numbers, this results in the original number, and the loop terminates. Otherwise, the program loops until a single digit is reached.
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 123 bytes
```
[Collections.ArrayList]$a=[char[]]"$args"
while(9-lt-join$a){$a.remove(($b=($a|sort)[-1]));$a=[char[]]"$(+"$b"*-join$a)"}$a
```
[Try it online!](https://tio.run/##VcyxCsIwEADQ3c8INyRKClGwFOkgrv5ByHAtwUbOnlyCRdRvj5ODH/DenZcoeYpEtfoTE8WxJJ5zcxTB5znlEgB7P04oPgQFKJesVsuUKOrOUrFXTjOgeQE2Em/8iFrD0GvAd2YpxlsXjDn8HXqjYFDrH1UfwFpr57btrnX7Lw "PowerShell – Try It Online")
Ooof. PowerShell arrays are immutable, so we need to use the lengthy `[Collections.ArrayList]` casting here so we can call `.remove()` later.
Takes input `$args`, converts it to a string, then a `char`-array, then an `ArrayList`. Stores that into `$a`. Then we `while` loop until we're at or below `9`. Each iteration, we're calling `.remove` on the largest element of `$a` (done by `sort` and taking the last element `[-1]`), storing the largest element into `$b` at the same time. This happens to work because the ASCII values sort in the same fashion as the literal digits.
Next, we recompute `$a`, again as an `char`-array (and `ArrayList` implicitly), by casting our `$b` (which is currently a `char`) to a string, then an int with `+`, and multiplying that to `$a` `-join`ed into a string (implicitly cast to int). This satisfies the "multiply by D" portion of the challenge.
Finally, once we're out of the loop, we put `$a` onto the pipeline and output is implicit.
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), ~~177~~ 164 + 18 bytes
Saved 13 bytes thanks to @raznagul!
```
int f(int n){string s=n+"",m=s.Max(d=>d)+"";if(n<10)return n;var x=s.ToList();x.RemoveAt(s.IndexOf(m));int y=int.Parse(string.Join("",x))*int.Parse(m);return f(y);}
```
[Try it online!](https://tio.run/##jY/NbsIwEITP@CksTnZbAkkgIXKDVPXUClTUVuqh6sFKHGSJ2KrXoCDEs6c2f701vVizu593ZgsYFNqIdgNSrfDbDqyog7lU3wwVaw6Al0avDK/xHvXAcisLvNWyxAsuFQFr3K/PL8zNCqhDWqksroh/Fd2fxhhyddvv39U5BAvekDKfldQ1mKyIug9H1Ai7MQortuUGN45613MJllDWBK@i1lvxYAkET6oUzUtFakqZN9jl7g2W3IA4BwmetQvlrBpKb36HNWVni4rsKDu0DKHzoY9agV6L4MNIK9zVglQkc/v/mkdpB5BOuogwisddLkmcdDHjOMqS7B9ek2nXqiyM0jgNE48hNBziDA9mOPMqSr0ce@ku83ritd/ri@mR8Wmv1SmXL0cX0iW4ji9evpEg1DugQ/sD "C# (.NET Core) – Try It Online")
[Answer]
# Java 8, ~~126~~ 104 bytes
```
n->{for(;n>9;n=new Long((n+"").replaceFirst((n=(n+"").chars().max().getAsInt()-48)+"",""))*n);return n;}
```
-22 bytes thanks to *@OlivierGrégoire*.
**Explanation:**
[Try it here.](https://tio.run/##jZE/T8MwEMX3fopTJxuIpfxp0ihKJRYkJOjSETEY1w0uySWynQKq8tnDtWRFYTnL757v904@ypMM2k7jcf8xqlo6B8/S4HkBYNBre5BKw/ZyBahbrECx64G8IG1YUHFeeqNgCwgljBhszofWsgI3eYEl6k94ogeM4e1yyYXVXU0jH4x1nrRyktW7tI5x0cgvqpX29@4RPeNBsuZkuCMPvyGm1b63CFgMY3Fhd/1bTewpwqk1e2goPtt5a7B6eQXJf7Pvvp3XjWh7Lzpq@RoZCsVyft3jz36UzRiy1ZwjjOJkjpLG6ZwniaM8zf/BWq3nRuVhlMVZmPLpD4fxBw)
```
n->{         // Method with long as both parameter and return-type
  for(;n>9;  //  Loop as long as the number contains more than 1 digit
    n=       //   Replace the current number with:
      new Long((n+"").replaceFirst((n=(n+"").chars().max().getAsInt()-48)+"",""))
             //    Remove the first largest digit from the number,
      *n     //    and multiply this new number with the removed digit
  );         //  End of loop
  return n;  //  Return the result
}            // End of method
```
[Answer]
# C ~~103~~ , ~~95~~ , 90 bytes
```
a,b;t,m;f(n){for(t=m=0,a=b=1e9;a/=10;)if((t=n/a%10)>m)m=t,b=a;n=n>9?f(m*=n/b/10*b+n%b):n;}
```
[Try it online!](https://tio.run/##Hc7NasMwEATgu5/CBAxSvEE/dqyoy7r0OdocJKcqOmhTgm/Gz@7aPQ3MB8NMl59p2rYAEWcomATLJT1fYqZCGgJFMt8egyKjUeYkdmAVGqPlWGShGSIFZOLRvydRzjtGZfQ5ttxE@ca4bhk/Pu@0eLAO3NWBsV0PduiGHvrO@sH/N9dbD95Y1zkzgF6xKiGzkEt1nNkX8h1z28rq95V5TuLUPOrLWDePLz7BoZDEEVJirVRdrdsf)
[Answer]
# Java 8: 115 bytes
  
-10 bytes thanks to Jo King
  
  
Unfortunately you can't call a lambda function recursively, so an extra 11 bytes is needed for the method header. I am aware there is a shorter Java answer that loops instead, but I decided to come up with this on my own. 
```
long f(long n){int m=(n+"").chars().max().getAsInt()-48;return n>9?f(new Long((n+"").replaceFirst(""+m,""))*m):n;};
```
[Try it online](https://tio.run/##LU5Na8JAFLz7K5ac3tMm4Ae1NrSlF0HQk0fp4TVu0k13X8Lui7aE/Pa4iJcZmGE@arpQ2rSa6/PvWFgKQR36ICSmUKNtuFIl3ImxNyzKvQHPkgSz4od8AMwc/UWstHyGHQtgunrJvZbOs@L3zUcJrK9qHxvgEfS6tVTorfFBIElm7imqOHX4yvmQj233beP248KlMWflyDAcxRuuTl@KfBWwnxz/g2iXNZ1kbXTEMpSwmS/Wy/X8GTGfDMN4Aw)
[Answer]
# [Jq 1.5](https://stedolan.github.io/jq/), 86 bytes
```
until(.<10;"\(.)"|(./""|max)as$v|index($v)as$x|.[:$x]+.[1+$x:]|tonumber*($v|tonumber))
```
Expanded
```
until(
    .<10                    # until number is below 10
  ; "\(.)"                  # convert to string
  | (./""|max) as $v        # find largest digit, call it $v
  | index($v) as $x         # find index of digit
  | .[:$x]+.[1+$x:]         # remove digit
  | tonumber*($v|tonumber)  # convert back to number and multiply by $v
)
```
[Try it online!](https://tio.run/##PcvNEoIgFIbhPVfhmAvNIAHFn5puxFzY5MJG0RSMBdcemTru3mfOd15vk56sA7xZKSDxWiGIoy0jgAkN104AYZTtCClJ2fYbLLMo2Y8pJjGNMVvIgDaSi7px0RUHF/vuIs/WLjrbtm5L5ZWjM@maPyvlOtNfSqM8c1Thoxz7jsoKLTou20c1HOfFDs8z5tv1ou74aCDksmlgzXspZgzlB3ZSzPgB "jq – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/), 41 + 1 (`-p`) = 42 bytes
```
$m=(sort/./g)[-1];s/$m//;($_*=$m)>9&&redo
```
[Try it online!](https://tio.run/##K0gtyjH9/18l11ajOL@oRF9PP10zWtcw1rpYXyVXX99aQyVey1YlV9POUk2tKDUl//9/IzNjM5N/@QUlmfl5xf91fU31DAwN/usWAAA "Perl 5 – Try It Online")
[Answer]
# Lua, ~~137~~ 108 bytes
```
function f(n)while n>9 do b="0"g=b.gsub g(n,".",function(m)b=math.max(m,b)end)n=b*g(n,b,"",1)end print(n)end
```
Thanks to Jonathan S for golfing off 29 bytes.
[Try it online!](https://tio.run/##RYxBDoMgFET3PQVhBQ0aAQVZ0LtIFTWRb9Nq2ttT1Dbu3sy8zLQ2MfoV7ss4A/IE6HsYpw7BzaB2Rs7iAvfW5f1rdagnwHCO2d8ngTobmmXIQ/MhgTnaQUvBuutmOoYx41uFHs8RlvSdOHpiKMoyZC6eCL1jmVBXB1eJuZDlHurNUVKdqZTCqOOg@JlVfc6GCy01V3uh4hc)
[Answer]
# [D](https://dlang.org/), ~~188~~ ~~186~~ 185 bytes
```
import std.conv,std.algorithm;T f(T,U=string)(T u){if(u<10)return u;T[]r;u.text.each!(n=>r~=n.to!T-48);T m=r.maxElement;U s;r.remove(r.maxIndex).each!(n=>s~=n.to!U);return f(m*s.to!T);}
```
[Try it online!](https://tio.run/##TY9BS8NAEIXPza/Y3makLkY9CGO8efC@OYmH0EzaheyszO7GQKl/PcZS0MODBw@@x9cviw@fUbNJubf7KNPut3TjIarPx0DODOB2bZOyejkgOFPw5Acoz/UdKueiYgq59w@lYjPP2XK3P25Bmhf9bsTmuHW3j0@4gkKjNnTz68iBJVNrEqlVDnFiuCxv0vOMf4B0BbRI16cBwk26MJHOyxR9b0LnBdCcqs0/kTU@UrX5WiV4FBigrh/qe0SqzssP "D – Try It Online")
I hate lazy evaluation, so much. Any tips are welcome!
[Answer]
## Lua, 154 Bytes
I should have some ways to golf this down, I'm experimenting right now.
```
n=...z=table
while n+0>9 do
t={}T={}n=n..''n:gsub(".",function(c)t[#t+1]=c T[#T+1]=c
end)z.sort(t)x=t[#t]z.remove(T,n:find(x))n=z.concat(T)*x
end
print(n)
```
[Try it online!](https://tio.run/##HYtLCoMwFAD3OYXowqTKoz@ECukpshMXGmMN2Jeiz1ZSeva0djEwi5lxaUJACQBeUtOOhr0GO5oIs/31EnWOkXx/1A@UCJCmWN7mpeUxxHm/oCbrkGtBVULZoZY6UlWi/sYMdsLD7CbiJFa5JbWHydzd03CVY9lb7PgqBEoP2qFuiCuxW7eRPSaLxFGEEI7FqTh/AQ "Lua – Try It Online")
### Explanations
```
n=...                    -- define n as a shorthand for the argument
z=table                  -- define z as a pointer to the object table
while n+0>9              -- iterate as long as n is greater than 9
do                       -- n+0 ensure that we're using a number to do the comparison
  t={}                   -- intialise two tables, one is used to find the greatest digit
  T={}                   -- the other one is used to remove it from the string
  n=n..''                -- ensure that n is a string (mandatory after the first loop)
  n:gsub(".",function(c) -- apply an anonymous function to each character in n
               t[#t+1]=c -- fill our tables with the digits
               T[#T+1]=c
             end)        
  z.sort(t)              -- sort t to put the greatest digit in the last index
  x=t[#t]                -- intialise x to the value of the greatest digit
  z.remove(T,n:find(x))  -- remove the first occurence of x from the table T 
                         -- based on its position in the input string
  n=z.concat(T)*x        -- assign the new value to n
end                      -- if it still isn't a single digit, we're looping over again
print(n)                 -- output the answer
```
[Answer]
# [Pip](https://github.com/dloscutoff/pip), ~~22~~ 21 bytes
```
Wa>9a:aRAa@?YMXax*:ya
```
Takes input as a command-line argument. Verify all test cases: [Try it online!](https://tio.run/##K8gs@B/NpWDJpWBkzqVgbgokDI2MTYBcM2MzIGVibGRpZgkRNLUAClgaGpkbmxuaccUq@CpU/w9PtLNMtEoMckx0sI/0jUis0LKqTPxf@/@/bh4A "Pip – Try It Online")
### Explanation
Ungolfed, with comments:
```
                 a is 1st cmdline arg
W a>9 {          While a > 9:
  Y MXa           Yank max(a) into y
  a RA: a@?y ""   Find index of y in a; replace the character at that position with ""
  a *: y          Multiply a by y
}
a                Autoprint a
```
In the golfed version, the loop body is condensed into a single expression:
```
a:aRAa@?YMXax*:y
        YMXa      Yank max(a)
     a@?          Find its index in a
  aRA       x     Replace at that index with x (preinitialized to "")
             *:y  Multiply that result by y (using : meta-operator to lower the precedence)
a:                Assign back to a
```
[Answer]
# [Scala](http://www.scala-lang.org/), 121 bytes
```
x=>def g(y:Int):Int={if(y>9){val m=y.toString.max.asDigit;g(y.toString.replaceFirst(m.toString,"").toInt*m)}else y}
g(x)}
```
[Try it online!](https://tio.run/##bYzdioMwEEbv8xRDr5KytfUvNl0UCmVhL3rVJ0htlCwxFROKIj67m3ZBZenNDHPOfJ/JueLj/fojcgtnLjWI1gp9M3Cs6x49uILiAN/aQpr9LehhbNPsJgoocXdwjDxH2ssCdxkj/TNTpZ1n7xfbSF16FW89bk6ylPbTRWbRiFrxXHzJxlhcTfxjtSLucKXrigxCGQHdgErckmGs3YNVGheYEQLb7SYDhmYYJC8KDkcLnMQzjxfcD8JoEvtlDw3pexOFAaNsUrt/bfH@fYz5QRImPp0kRWgYfwE "Scala – Try It Online")
[Answer]
# pure [Bash](https://www.gnu.org/software/bash/), 116 112 bytes, or 101, or even 97?
Based on answers from [iBug](https://codegolf.stackexchange.com/a/148738/106907) and [Léa Gris](https://stackoverflow.com/a/68907322/490291) and [tips-for-golfing-in-bash](https://codegolf.stackexchange.com/questions/15279/tips-for-golfing-in-bash) (thanks, @AaronMiller and @BrowncatPrograms!):
```
#!/bin/bash
test112()
{
n=$1;shopt -s extglob;while((n>9));do m=0;for x in ${n//?()/ };{ ((m<x))&&m=$x;};n=$[10#${n/$m/}*m];done;echo $n
}
for k in 9 27 757 1234 26364 432969 1234584 91273716; do printf '%d -> ' "$k"; test112 "$k"; done
```
[Try it online!](https://tio.run/##LY/BisIwGITvfYpBs5oIUpPWxvBb90GWPWzXuC2aRGzAQumz13bxOMPwzUz109ZjtG2UUnGR9KMvmaS2DveIbQvbxb9bqOhZNzfLuT8ZIegc4ModXcIDHRoP1vs0/eQixUA9OHfHTojVypWso4Em4JfcLecQc@mwcd8TwFuyv3UA8@OQJDPpOpMMlIbea0iV5VBFVuTIM2UK8@/sDzmMVDrTsiBMM@6PxscL1h9nbE9YY8GuC8L7zlvNZeML "Bash – Try It Online")
Also there are two shorter variants:
```
#!/bin/bash
f()(shopt -s extglob;(($1>9))||exit $1;m=0;for x in ${1//?()/ };{ ((m<x))&&m=$x;};f $[10#${1/$m/}*m])
for k in 9 27 757 1234 26364 432969 1234584 91273716; do printf '%d -> ' "$k"; f "$k"; echo "$?"; done
```
([Try it online!](https://tio.run/##LYtLDoIwAAWv8oJVWxOCLUhtqngQ48IPFYKlBFg0Qc6OYly9ycvM7doV02Qoo13hmh5hh9z3z5e7aUoJzxRj73fuyx6Ea3vcauNaeJQ1yMCj6ERZhFEPoNQePGOrlT0Sr0dtQM58u5glYqNxYy9smtNqThWEhNxJcBEnEGmcJkhioVL1e3b7BIoLGUueajwcmrase4P18oEwwxoBqQIN89/8XrgvnoLZrfPpAw "Bash – Try It Online")) with 101 bytes and with 97 bytes ([Try it online!](https://tio.run/##NU/LcoIwALzzFTs0FdKOhgCSZoJ4qtd@QKcH5SGMhjiSQ2aUb6fSx213Zx@zh/3QTuXeojiac7MaWuR58P6xC6ahNReL5YDa2ePZHFQYEl5ISu/32nUWhCu9iVRjrnDoepAbZ2wbUoZR3RCGOneULhZ6Q5waFYlAPnn0NLuIZuOL/poeM55XttpUeHX42/fmwtNcKBELiLUAj5MUcZZkKdIklpn8UdZvKSSPRSJ4plAZXK5dbxsEzxWWBQL45OQrrNj/sV9el615wK0/Z/p6@gY "Bash – Try It Online")):
```
shopt -s extglob;(($1>9))||exit $1;m=0;for x in ${1//?()/ };{ ((m<x))&&m=$x;};$0 $[10#${1/$m/}*m]
```
But I am not entirely sure the last two apply to the rules. The latter even uses `$0` (I neither found a rule allowing that nor denying this) to recurse to itself, so it only works if put into a script (like `golf.sh`), made executable and then is called like `golf.sh 91273716; echo $?`
Output of the scripts:
```
9 -> 9
27 -> 4
757 -> 5
1234 -> 8
26364 -> 8
432969 -> 0
1234584 -> 8
91273716 -> 6
```
Explained first variant (112 bytes):
```
n=$1;                           # (*) get argument n
shopt -s extglob;               # enable ${n//?()/ } below
while((n>9));do                 # loop until number is <=9
  m=0;                          # preset maximum to 0
  for x in ${n//?()/ };{        # loop over the digits
    ((m<x))&&m=$x;              # find max
  };
  n=$[                          # calculate new number
      10#                       # force base 10 as 0N becomes octal
         ${n/$m/}               # remove first occurance of max
                 *m];           # multiply m
done;
echo $n                         # output result
```
Notes:
* Shebang `#!/bin/bash`+`LF` (12 byte) is not included in the count.
	+ We are in `bash`, so this is already the default
* AFAICS passing in the number directly as variable `n` (see marked `(*)` above) is not allowed. Hence these 5 bytes are needed.
	+ Else `./golf.sh 1234` would look like `n=1234 ./golf.sh`
	+ A `read n;` if number is passed in from STDIN is 2 byte longer
* `shopt -s extglob;` can be left away, if this option is given on commandline
	+ Like in `n=1234 bash -Oextglob ./golf.sh`
	+ But `extglob` is not set by default, hence AFAICS it must be included in the count
* `10#` is needed as `${n/$m/}` can leave a number with a leading `0`
	+ Without the `10#` input `91273716` wrongly returns `8`.
Explained shortest variant (97 bytes):
```
shopt -s extglob;                           # see above
(($1>9))||exit $1;                          # stop if goal reached
m=0;for x in ${1//?()/ };{ ((m<x))&&m=$x;}; # max calc, as above
$0 $[10#${1/$m/}*m]                         # recurse to next step
```
Notes:
* Actually the last line is a tail recursion, so bash uses `exec` and does not `fork`
[Answer]
# J, 40 bytes
```
((]*<^:3@i.{[)>./)&.(10&#.inv)^:(9&<)^:_
```
[Try it online!](https://tio.run/##Xc3PCgIhEAbwu08xFLgaYf53lTV6j2g7RNJ2qMNCl@jZbVEP0WEYfh/fMPecZogBOCyTCTlthjGow8TeR7pnO4oZERyv2fR40TEQj4dlnTNFKwZdiqGDLXwCpBmh6@X2BA8REvgKXSBdlSlyprEvFFLpX0urbAt4CbSS3vr/E9O3kq3/hHTKCZu/ "J – Try It Online")
## explanation
```
(      iterate                   )^:(9&<)^:_    NB. keep iterating while the number is > 9
 (     stuff         )&.(10&#.inv)              NB. convert to digits, do stuff, convert back to number
 (           )>./)                              NB. stuff is a hook, with max digit >./  on the right
 (]*<^:3@i.{[)                                  NB. so that in this phrase, ] means "max" and [ means "all digits"
  ]                                             NB. the max digit...
   *                                            NB. times...        
    <^:3@                                       NB. triple box...
         i.                                     NB. the first index of the max in the list of all digits
           {                                    NB. "from" -- which because of the triple box means "take all indexes except..."
            [                                   NB. from all the digits of the number
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 230 bytes
```
$n="$args";do{$n=$n.ToString();$a=@();0..$n.Length|%{$a+=$n[$_]};$g=[convert]::ToInt32(($a|sort|select -last 1),10);[regex]$p=$g.ToString();[int]$s=$p.replace($n,'',1);if($n.Length-eq1){$n;exit}else{$r=$s*$g}$n=$r}until($r-lt10)$r
```
[Try it online!](https://tio.run/##TY9BSwMxFIT/SilPmuju0rSeGgJeBW/2tiwS1tc0EJL15amF3f3tMV7E0zDDwDczpW@kfMUQSoFotmDJ5a1@T3N1ELtzemXy0QmpwZqnKvuuq/kLRsfX5W4G@1B7PbwNqwZn@jHFLyQeTqdzeo58PAgBdsmJeMkYcORNG2zmjZKN2kvdEzq8DTAZcP9hvY88QDYwdYRTsCMKiM1u1yip/UX8LWjxQ8m6VePN84oh4wxkIN@DW38f0PoZ2QcB1AauQKBSijocH38A "PowerShell – Try It Online")
Wasted too much on all the type casting.
[Answer]
# PHP, ~~82~~ 77+1 bytes
```
for($n=$argn;$n>9;)$n=join("",explode($d=max(str_split($n)),$n,2))*$d;echo$n;
```
Run as pipe with `-nR` or [try it online](http://sandbox.onlinephpfunctions.com/code/1b43af319f7f88767c5a4ee06bf34fca64432bb4).
]