OFFSET
1,3
COMMENTS
This sequence has similarities with A055527; here we look for triples (n, k, m) of positive integers such that n^2 XOR k^2 = m^2, there for triples such that n^2 + k^2 = m^2.
Conjecture: a(n) > 0 for any n > 2.
LINKS
Karl-Heinz Hofmann, Table of n, a(n) for n = 1..10000
Interactive scatterplot of (x, y, z) such that x^2 XOR y^2 = z^2 and x, y, z < 2^13 [provided your web browser supports the Plotly library, you should see icons on the top right corner of the page: if you choose "Orbital rotation", then you will be able to rotate the plot alongside three axes]
Rémy Sigrist, Logarithmic scatterplot of the first 140000 terms
EXAMPLE
For n = 6: we have:
k 6^2 XOR k^2 Positive square?
-- ----------- ----------------
1 37 No
2 32 No
3 45 No
4 52 No
5 61 No
6 0 No
7 21 No
8 100 Yes
So a(6) = 8.
MAPLE
f:= proc(n) local k;
for k from 1 by 1 do if k <> n and issqr(MmaTranslator[Mma]:-BitXor(n^2, k^2)) then return k fi od
end proc: f(1):= -1: f(2):= -1:
map(f, [$1..100]); # Robert Israel, Mar 01 2024
MATHEMATICA
A370574[n_] := If[n <= 2, -1, Block[{k = 0}, While[++k == n || !IntegerQ[ Sqrt[BitXor[n^2, k^2]]]]; k]]; Array[A370574, 100] (* Paolo Xausa, Mar 01 2024 *)
PROG
(PARI) a(n) = { if (n <= 2, return (-1), for (k = 1, oo, if (k!=n && issquare( bitxor(n^2, k^2)), return (k)); ); ); }
(Python)
from sympy import integer_nthroot
def A370574(n):
if n <= 2: return -1
k, n_2 = 1, n**2
while True:
if (integer_nthroot(n_2 ^ k**2, 2))[1] and k != n: return k
k += 1 # Karl-Heinz Hofmann, Mar 03 2024
CROSSREFS
KEYWORD
sign,base
AUTHOR
Rémy Sigrist, Feb 22 2024
STATUS
approved