Every natural number, ```n```, may have a prime factorization like:
We define the arithmetic derivative of ```n```, ```n'``` the value of the expression:
Let's do the calculation for ```n = 231525```.
```
231525 = 3³5²7³ 
n' = (3*3²)*5²7³ + 3³*(2*5)*7³ + 3³*5²*(3*7²) = 231525 + 92610 + 99225 = 423360
```
We may make a chain of arithmetic derivatives, starting from a number we apply to the result the transformation and so on until we get the result ```1```.
```
n ---> n'  ---> (n')' ---> ((n')')' ---> ..... ---> ((...(n')...)')'
```
Let's do it starting with our number, ```n = 231525``` and making a chain of 5 terms:
```
231525 ---> 423360 ---> 1899072 ---> 7879680 ---> 51895296
```
We need a function ```chain_arith_deriv()``` that receives two arguments: ```start``` and ```k```, amount of terms of the chain.
The function should output the chain in an array format:
```
chain_arith_deriv(start, k) ---> [start, term1, term2, .....term(k-1)] # a total of k-terms
```
For the case presented above:
```python
chain_arith_deriv(231525, 5) == [231525, 423360, 1899072, 7879680, 51895296]
```
The function has to reject prime numbers giving an alerting message
```python
chain_arith_deriv(997, 5) == "997 is a prime number"
```
Features of the tests:
```
Number of Random Tests: 50
1000 ≤ start ≤ 99000000
3 ≤ k ≤ 15
```
Enjoy it and do your best!
def _prime_factors(n):
    factors = {}
    i = 2
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            if i in factors.keys():
                factors[i] += 1
            else:
                factors[i] = 1
    if n > 1:
        if n in factors.keys():
            factors[n] += 1
        else:
            factors[n] = 1

    return factors


def chain_arith_deriv(start, m, chain=None):
    factors = _prime_factors(start)
    if len(factors) == 1 and chain is None:
        return '{} is a prime number'.format(start)
    if chain is None:
        chain = []
    chain.append(start)

    if m == 1:
        return chain
    elif start == 1:
        next_num = 1
    else:
        next_num = 0
        for p, k in factors.items():
            next_num += k/p*start
    return chain_arith_deriv(round(next_num), m-1, chain=chain)
def _prime_factors(n):
    factors = {}
    i = 2
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            if i in factors.keys():
                factors[i] += 1
            else:
                factors[i] = 1
    if n > 1:
        if n in factors.keys():
            factors[n] += 1
        else:
            factors[n] = 1

    return factors


def chain_arith_deriv(start, m, chain=None):
    factors = _prime_factors(start)
    if len(factors) == 1 and chain is None:
        return '{} is a prime number'.format(start)
    if chain is None:
        chain = []
    chain.append(start)

    if m == 1:
        return chain
    elif start == 1:
        next_num = 1
    else:
        next_num = 0
        for p, k in factors.items():
            next_num += k/p*start
    return chain_arith_deriv(round(next_num), m-1, chain=chain)