[Question]
  [
**Challenge:**
You are given a base 10 number. For each base from 10 counting down to base 2:
1. Take the original input number as a base 10 string, and remove any
digits of the number which are invalid for the base.
2. Interpret the resulting number string in the that base. If this gives 1 or 0, terminate the whole process.
3. Output or print its largest prime factor, as decimal number.
The output can be an array of the largest prime factors.
**Sample cases:**
Input:
```
987654321
```
Output:
```
379721
10593529
1091
179
1493
293
19
7
```
Alternately:
```
[379721,10593529,1091,179,1493,293,19,7]
```
This prints the largest prime factors of \$987654321\$, \$87654321\_9 = 42374116\_{10}\$, \$7654321\_{8} = 2054353\_{10}\$, and so on until it reaches \$1\_2\$, where it stops.
  
[Answer]
## Pyth, 25 bytes
```
sfTm>1PiFdC,.u-N`tYKrT1zK
```
```
                       z   get input as a string
            .u      rT1    cumulative reduce over [10,9,...,2]
              -N`tY        remove one minus the number (10,9,...) from the input
          C,       K    K  pair each step along the chain with corresponding base
   m                       map over [["987654321", 10],...]:
       iFd                   apply the base-conversion (splat over i)
      P                      prime factorization, smallest to largest
    >1                       take [the last element], or [] if empty (1 or 0)
 fT                        remove the []s from 0s or 1s
s                          join the one-element arrays together
```
[Try it here.](https://pyth.herokuapp.com/?code=sfTm%3E1PiFdC%2C.u-N%60tYKrT1zK&input=987654321&debug=0)
[Answer]
# Pyth - 16 bytes
```
V_S9#ePi~-z`NhNB
```
[Try it online here](http://pyth.herokuapp.com/?code=V_S9%23ePi%7E-z%60NhNB&input=987654321&debug=0).
~~There are sometimes a few blank lines on inputs without all the digits, lemme know if that's a problem.~~
[Answer]
# [MATL](https://esolangs.org/wiki/MATL), ~~17~~ 15 bytes
```
9:PQ"G@ZAYfXzX>
```
This takes the number as a string with quotes, which is allowed by default.
[**Try it online!**](http://matl.tryitonline.net/#code=OTpQUSJHQFpBWWZYelg-&input=Jzk4NzY1NDMyJw)
### Explanation
```
9:PQ     % Push array [10, 9, ..., 2]
"        % For each number in that array. These are the bases to be considered
  G      %   Push input. Forces for input to be taken implicitly first time
  @      %   Push current base
  ZA     %   Convert from that base to base 10, discarding non-valid digits
  Yf     %   Prime factors. Gives empty for input 1, and 0 for input 0
  Xz     %   Non-zero values. Gives empty if previous result was 0, or else
         %   leaves it as it was
  X>     %   Maximum of array. For empty input gives empty
         % Implicitly end for each
         % Implicitly display. Empty arrays are not displayed
```
[Answer]
# Julia, 101 bytes
```
f(s,x=[],b=10)=(t=filter(c->c<=47+b,s))>"1"&&b>1?f(s,[x;maximum(keys(factor(parse(Int,t,b))))],b-1):x
```
This is a recursive function that accepts the input as a string and returns an array.
Ungolfed:
```
function f(s, x=[], b=10)
    # Filter the string down to only the digits valid for base b
    t = filter(c -> c <= 47 + b, s)
    # If the filtered string isn't "1" or "0" and b is a valid base
    if t > "1" && b > 1
        # Call the function again, appending the maximum prime factor
        # of t in base b to the argument x and decrementing the base
        f(s, [x; maximum(keys(factor(parse(Int, t, b))))], b-1)
    else
        # Otherwise return the array
        x
    end
end
```
[Answer]
# Mathematica, 83 bytes
```
FactorInteger[Select[IntegerDigits@#,#<a&]~FromDigits~a][[-1,1]]~Table~{a,10,2,-1}&
```
Anonymous function, returns a list. Not that complicated, to be honest.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 14 bytes
```
D<ƇḅṛɗⱮ⁵ÆfṀ€t0
```
[Try it online!](https://tio.run/##ATAAz/9qZWxsef//RDzGh@G4heG5m8mX4rGu4oG1w4Zm4bmA4oKsdDD///85ODc2NTQzMjE "Jelly – Try It Online")
## How it works
```
D<ƇḅṛɗⱮ⁵ÆfṀ€t0 - Main link. Takes an integer n on the left
D              - Cast n to digits, D
     ɗ         - Previous 3 links as a dyad f(D, k):
 <Ƈ            -   Keep elements of D less than k
    ṛ          -   Yield k
   ḅ           -   Convert to base k
       ⁵       - 10
      Ɱ        - Yield the range 1 ≤ k ≤ 10 and map f(D, k) over each
        Æf     - Prime factors
          Ṁ€   - Maximum of each, or 0 if empty list
            t0 - Trim zeros
```
[Answer]
# Ruby, 120 bytes
Recursive function, takes the input as a string.
```
f=->n,b=2{require'prime';i=n.tr([*b.to_s..?9].join,"").to_i(b)
b>10?[]:f[n,b+1]+[*i>1?Prime.prime_division(i).max[0]:p]}
```
[Answer]
## Pyke, 19 bytes, noncompeting
(add splat\_node functon)
```
DTAbPe
;1TtD=T`"":r
```
[Try it here!](http://pyke.catbus.co.uk/?code=DTAbPe%0A%3B1TtD%3DT%60%22%22%3Ar&input=%22987654321%22)
Takes input in quotes, exits with an error.
Explanation (newline replaced with \n):
```
D                    - Duplicate the first item on the stack (And get it from input first time)
 TAb                 - Convert input to base (whatever's in T, 10 default)
    Pe               - get the highest prime factor of the number
      \n;1           - print it out and get rid of it
          TtD=T      - T -= 1
               `"":  - input = input.replace(str(t), "")
                   r - GOTO start
```
]