cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A370574 #22 Mar 03 2024 13:42:02
%S A370574 -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,
%T A370574 86,20,59,20,72,56,24,479,222,20,15,20,360,15,24,183,144,13,11,11,18,
%U A370574 943,14,1103,14,747,172,405,40,159,31,492,40,28,144,28,112,31,48,660
%N 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.
%C A370574 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.
%C A370574 Conjecture: a(n) > 0 for any n > 2.
%H A370574 Karl-Heinz Hofmann, <a href="/A370574/b370574.txt">Table of n, a(n) for n = 1..10000</a>
%H A370574 <a href="https://practical-ardinghelli-959d8f.netlify.app/a370574">Interactive scatterplot of (x, y, z) such that x^2 XOR y^2 = z^2 and x, y, z < 2^13</a> [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]
%H A370574 Rémy Sigrist, <a href="/A370574/a370574.png">Logarithmic scatterplot of the first 140000 terms</a>
%e A370574 For n = 6: we have:
%e A370574   k   6^2 XOR k^2  Positive square?
%e A370574   --  -----------  ----------------
%e A370574    1           37  No
%e A370574    2           32  No
%e A370574    3           45  No
%e A370574    4           52  No
%e A370574    5           61  No
%e A370574    6            0  No
%e A370574    7           21  No
%e A370574    8          100  Yes
%e A370574 So a(6) = 8.
%p A370574 f:= proc(n) local k;
%p A370574   for k from 1 by 1 do if k <> n and issqr(MmaTranslator[Mma]:-BitXor(n^2, k^2)) then return k fi od
%p A370574 end proc: f(1):= -1: f(2):= -1:
%p A370574 map(f, [$1..100]); # _Robert Israel_, Mar 01 2024
%t A370574 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 *)
%o A370574 (PARI) a(n) = { if (n <= 2, return (-1), for (k = 1, oo, if (k!=n &&  issquare( bitxor(n^2, k^2)), return (k)););); }
%o A370574 (Python)
%o A370574 from sympy import integer_nthroot
%o A370574 def A370574(n):
%o A370574     if n <= 2: return -1
%o A370574     k, n_2 = 1, n**2
%o A370574     while True:
%o A370574         if (integer_nthroot(n_2 ^ k**2, 2))[1] and k != n: return k
%o A370574         k += 1 # _Karl-Heinz Hofmann_, Mar 03 2024
%Y A370574 Cf. A055527.
%K A370574 sign,base
%O A370574 1,3
%A A370574 _Rémy Sigrist_, Feb 22 2024