(Almost) Solve Fermat's Last Theorem It's a well-known fact that Fermat's Last Theorem is true. More specifically, that for any integer \$n \gt 2\$, there are no three integers \$a, b, c\$ such that
$$a^n + b^n = c^n$$
However, there are a number of near misses. For example,
$$6^3 + 8^3 = 9^3 - 1$$
We'll call a triple of integers \$(a, b, c)\$ a &quot;Fermat near-miss&quot; if they satisfy
$$a^n + b^n = c^n \pm 1$$
for some integer \$n &gt; 2\$. Note that this includes negative values for \$a, b, c\$, so \$(-1, 0, 0)\$ is an example of such a triple for any \$n\$.

Your task is to take an integer \$n &gt; 2\$ as input, in any convenient method. You may then choose which of the following to do:

Take a positive integer \$m\$ and output the \$m\$-th Fermat near-miss for that specific \$n\$
Take a positive integer \$m\$ and output the first \$m\$ Fermat near-misses for that specific \$n\$

For either of these two, you may choose any ordering to define the &quot;\$m\$th&quot; or &quot;first \$m\$&quot; terms, so long as the ordering eventually includes all possible triples. For example, the test case generator program below orders them lexographically.


Output all Fermat near-misses for that specific \$n\$

The output may be in any order, so long as it can be shown that all such triples will eventually be included. The output does not have to be unique, so repeated triples are allowed.
You may output in any format that allows for infinite output, such as an infinite list or just infinite output. You may choose the delimiters both in each triple and between each triple, so long as they are distinct and non-digital.



This is code-golf so the shortest code in bytes wins

This program was helpfully provided by Razetime which outputs all solutions with \$|a|, |b|, |c| \le 50\$ for a given input \$n\$*.
This is a question asked over on MathOverflow about the existence of non-trivial solutions to
$$a^n + b^n = c^n \pm 1$$
Unfortunately, it appears (although is not proven, so you may not rely on this fact) that no non-trivial solutions exist for \$n \ge 4\$, so for most \$n\$, your output should be the same.
*Currently, this also returns exact matches, which your program shouldn’t do.
R, 119 110 108 105 100 bytes
Edit: -2 bytes thanks to Giuseppe

n=scan();repeat for(b in -(F=-F+!(F&gt;0)):F)for(i in (d=-(c=F^n+b^n):c)[abs(d^n-c)==1])cat(F,b,i,'\n')

Try it online!
Prints the infinite list of near-misses, without duplicates (this includes duplicates by re-ordering a and b, so the triples (a,b,c) and (b,a,c) are considered duplicates: add an extra ,b,F,i,'\n' (11 bytes) to print the list with duplicates).
Wastes a few bytes avoiding taking nth-roots, to prevent floating-point errors.
How?
function(n){
                            # note: F (false), which represents variable a, is initialized to zero;
repeat{                     # repeat for ever:
 for(b in -F:F){            # try all possible values of b from -a to a,
  c=F^n+b^n                 # calculate c as a^n+b^n,
  c=(-c:c)                  # now find value in the range -c to c
  [(-c:c)^n%in%(c+c(1,-1))] # that gives either c+1 or c-1 when raised to the n-th power
                            # replace c with this value (if there is one),
  for(i in c)               # now, if there were any:
   print(c(F,b,i))}         # print out the a,b,c combination
 F=-F+!(F&gt;0)}}              # update F to the next value of variable a, in the sequence:
                            # 0, 1, -1, 2, -2, 3, -3 ... and so on