OFFSET
0,3
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8192
FORMULA
a(n) = 0 iff n is a cube.
EXAMPLE
For n = 4:
- 4 XOR 0 = 4 (not a cube),
- 4 XOR 1 = 5 (not a cube),
- 4 XOR 2 = 6 (not a cube),
- 4 XOR 3 = 7 (not a cube),
- 4 XOR 4 = 0 = 0^3,
- hence a(4) = 4.
MATHEMATICA
A330271[n_] := Module[{k = -1}, While[!IntegerQ[CubeRoot[BitXor[n, ++k]]]]; k];
Array[A330271, 100, 0] (* Paolo Xausa, Feb 20 2024 *)
PROG
(PARI) a(n) = for (k=0, oo, if (ispower(bitxor(n, k), 3), return (k)))
(Python)
from itertools import count
from sympy import integer_nthroot
def A330271(n): return next(k for k in count(0) if integer_nthroot(n^k, 3)[1]) # Chai Wah Wu, Aug 23 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Dec 08 2019
STATUS
approved