Question: A simple but hopefully not quite trivial challenge:

Write a program or function that adds up the `k`th powers dividing a number `n`. More specifically:

* Input: two positive integers `n` and `k` (or an ordered pair of integers, etc.)
* Output: the sum of all of the positive divisors of `n` that are `k`th powers of integers

For example, 11! = 39916800 has six divisors that are cubes, namely 1, 8, 27, 64, 216, and 1728. Therefore given inputs `39916800` and `3`, the program should return their sum, `2044`.

Other test cases:

```
{40320, 1} -> 159120
{40320, 2} -> 850
{40320, 3} -> 73
{40320, 4} -> 17
{40320, 5} -> 33
{40320, 6} -> 65
{40320, 7} -> 129
{40320, 8} -> 1
{46656, 1} -> 138811
{46656, 2} -> 69700
{46656, 3} -> 55261
{46656, 4} -> 1394
{46656, 5} -> 8052
{46656, 6} -> 47450
{46656, 7} -> 1
{1, [any positive integer]} -> 1

```

This is code golf, so the shorter your code, the better. I welcome golfed code in all kinds of different languages, even if some other language can get away with fewer bytes than yours.

Answer: 
[APL (Dyalog Classic)](https://www.dyalog.com/), 14 bytes
=========================================================

```apl
+/*⍨∘⍳(⊣×0=|)⊢

```

[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@ob6pb0KO2CYZGFub/tfW1HvWueNQx41HvZo1HXYsPTzewrdF81LXofxpQyaPevkddzYfWGz9qmwjUFhzkrACkQjw8g/8bKqQpmBgYGxlwGcFZxnCWCZxlCmeZwVnmcJYFnAU2z8zM1AxiHphlDGeZwFmmcJYZnGUOZwEA "APL (Dyalog Classic) – Try It Online")

Takes the power as the left argument and the number as the right. Even at 128-bit precision, the last couple of test cases exceed the max int size.

### Explanation:

```apl
     ⍳            ⍝ The range 1 to right argument
  *⍨∘             ⍝ Each raised to the power of the left argument
      (     )⊢    ⍝ Apply the train to this and the right argument
       ⊣×         ⍝ Multiply each power
         0=|      ⍝ By if the right argument is divisible by it
+/                ⍝ And sum

```
PHP, 86 bytes
=============

```
$n=$argv[1];$k=$argv[2];for($i=1;$i<=$n**(1/$k);$i++)if($n%$i**$k<1)$s+=$i**$k;echo$s;

```

[Try it here !](https://eval.in/734616)

**Breakdown :**

```
$n=$argv[1];$k=$argv[2];       # Assign variables from input
for($i=1;$i<=$n**(1/$k);$i++)  # While i is between 1 AND kth root of n
    if($n%$i**$k<1)            #     if i^k is a divisor of n
        $s+=$i**$k;            #         then add to s
echo$s;                        # echo s (duh!)

```