|
|
A370574
|
|
a(n) is the least k > 0 such that n^2 XOR k^2 is a positive square number (where XOR denotes the bitwise XOR operator), or -1 if no such k exists.
|
|
1
|
|
|
-1, -1, 4, 3, 3, 8, 24, 6, 23, 6, 44, 16, 43, 48, 36, 12, 111, 46, 180, 12, 72, 88, 9, 7, 7, 86, 20, 59, 20, 72, 56, 24, 479, 222, 20, 15, 20, 360, 15, 24, 183, 144, 13, 11, 11, 18, 943, 14, 1103, 14, 747, 172, 405, 40, 159, 31, 492, 40, 28, 144, 28, 112, 31, 48, 660
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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:
|
|
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
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|