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.

A330271 a(n) is the least nonnegative integer k such that n XOR k is a cube (where XOR denotes the bitwise XOR operator).

This page as a plain text file.
%I A330271 #19 Feb 20 2024 04:19:31
%S A330271 0,0,2,2,4,4,6,6,0,1,2,3,4,5,6,7,11,10,9,8,15,14,13,12,3,2,1,0,7,6,5,
%T A330271 4,32,32,34,34,36,36,38,38,32,33,34,35,36,37,38,39,43,42,41,40,47,46,
%U A330271 45,44,35,34,33,32,39,38,37,36,0,1,2,3,4,5,6,7,8,9
%N A330271 a(n) is the least nonnegative integer k such that n XOR k is a cube (where XOR denotes the bitwise XOR operator).
%H A330271 Rémy Sigrist, <a href="/A330271/b330271.txt">Table of n, a(n) for n = 0..8192</a>
%H A330271 Rémy Sigrist, <a href="/A330271/a330271.png">Scatterplot of the ordinal transform of the first 2^20 terms</a>
%H A330271 Rémy Sigrist, <a href="/A330271/a330271_1.png">Scatterplot of (x, y) such that x XOR y is a cube, 0 <= x, y <= 1023</a>
%F A330271 a(n) = 0 iff n is a cube.
%e A330271 For n = 4:
%e A330271 - 4 XOR 0 = 4 (not a cube),
%e A330271 - 4 XOR 1 = 5 (not a cube),
%e A330271 - 4 XOR 2 = 6 (not a cube),
%e A330271 - 4 XOR 3 = 7 (not a cube),
%e A330271 - 4 XOR 4 = 0 = 0^3,
%e A330271 - hence a(4) = 4.
%t A330271 A330271[n_] := Module[{k = -1}, While[!IntegerQ[CubeRoot[BitXor[n, ++k]]]]; k];
%t A330271 Array[A330271, 100, 0] (* _Paolo Xausa_, Feb 20 2024 *)
%o A330271 (PARI) a(n) = for (k=0, oo, if (ispower(bitxor(n,k),3), return (k)))
%o A330271 (Python)
%o A330271 from itertools import count
%o A330271 from sympy import integer_nthroot
%o A330271 def A330271(n): return next(k for k in count(0) if integer_nthroot(n^k,3)[1]) # _Chai Wah Wu_, Aug 23 2023
%Y A330271 See A330270 for the square variant.
%Y A330271 See A330272 for the OR variant.
%Y A330271 Cf. A000578, A003987, A296615.
%K A330271 nonn,base
%O A330271 0,3
%A A330271 _Rémy Sigrist_, Dec 08 2019