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.

A384441 Binary XOR of n and the prime factors of n.

Original entry on oeis.org

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

Views

Author

Karl-Heinz Hofmann, May 30 2025

Keywords

Examples

			For n = 12 the prime factors are {2,3} -> a(12) = 12 XOR 2 XOR 3 = 13.
a(13) = 13 XOR 13 = 0.
		

Crossrefs

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
    

Formula

a(n) = XOR(n,A293212(n)).
a(n) = 0 <=> n is prime.
a(2^n) = A052548(n) for n>=2.