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 "Fermat near-miss" if they satisfy
$$a^n + b^n = c^n \pm 1$$
for some integer \$n > 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 > 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 "\$m\$th" or "first \$m\$" 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.