A384441 Binary XOR of n and the prime factors of n.
1, 0, 0, 6, 0, 7, 0, 10, 10, 13, 0, 13, 0, 11, 9, 18, 0, 19, 0, 19, 17, 31, 0, 25, 28, 21, 24, 25, 0, 26, 0, 34, 41, 49, 33, 37, 0, 55, 41, 47, 0, 44, 0, 37, 43, 59, 0, 49, 54, 53, 33, 59, 0, 55, 57, 61, 41, 37, 0, 56, 0, 35, 59, 66, 73, 72, 0, 87, 81, 70, 0, 73, 0, 109
Offset: 1
Examples
For n = 12 the prime factors are {2,3} -> a(12) = 12 XOR 2 XOR 3 = 13. a(13) = 13 XOR 13 = 0.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..16384
- Karl-Heinz Hofmann, Graph up to n = 2^17
- Karl-Heinz Hofmann, Zoom trip of the graph with number of prime factors of n colored.
- Wikipedia, Bitwise operation: XOR
Programs
-
Maple
f:= l-> `if`(l=[], 0, Bits[Xor](l[1], f(l[2..-1]))): a:= n-> f([n, map(i-> i[1], ifactors(n)[2])[]]): seq(a(n), n=1..74); # Alois P. Heinz, May 30 2025
-
Mathematica
a[n_] := BitXor @@ Join[{n}, FactorInteger[n][[;; , 1]]]; a[1] = 1; Array[a, 100] (* Amiram Eldar, May 30 2025 *)
-
PARI
a(n) = my(f=factor(n)[,1]); my(b=n); for (k=1, #f, b=bitxor(b, f[k])); b; \\ Michel Marcus, May 30 2025
-
Python
from sympy import primefactors def A384441(n): result = n for pf in primefactors(n): result ^= pf return result