Write numbers as a difference of Nth powers

Jelly, 8 bytes

p*ƓIFẹ+d

This is a monadic link that takes the number as argument and reads n from STDIN.

Try it online!

How it works

p*ƓIFẹ+d  Main link. Argument: k

p         Cartesian product; yield all pairs [b, a] with b and a in [1, ..., k].
  Ɠ       Get; read an integer n from STDIN.
 *        Power; map each [b, a] to [b**n, a**n].
   I      Increments; map each [b**n, a**n] to [a**n-b**n].
    F     Flatten the resulting list of singleton arrays.
     ẹ    Every; find all indices of k in the list we built.
      +   Add k to the indices to correct the offset.
       d  Divmod; map each index j to [j/k, j%k].

Haskell, 42 bytes

k#n=[(a,b)|b<-[1..k],a<-[b..k],a^n-b^n==k]

Try it online!

Ungolfed with UniHaskell and -XUnicodeSyntax

import UniHaskell

f     ∷ Int → Int → [(Int, Int)]
f k n = [(a, b) | b ← 1 … k, a ← b … k, a^n - b^n ≡ k]

Can't change much else...


MATL, 11 bytes

t:i^&-!=&fh

Try it online! Or verify all test cases.

Explanation

t     % Implicit input: M. Duplicate
:     % Range [1 2 ... M]
i     % Input: n
^     % Power, element-wise. Gives [1^n 2^n ... M^n]
&-    % Matrix of pairwise differences (size n×n)
!     % Transpose. Needed so the two numbers in each pair are sorted as required
=     % Is equal? Element-wise. Gives true for entries of the matrix equal to M
&f    % Row and column indices of true entries
h     % Concatenate horizontally. Implicit display