OFFSET
1,2
COMMENTS
LINKS
R. Zumkeller, Table of n, a(n) for n = 1..10000
EXAMPLE
a(35) = a(5*7) = a(5) 'xor' a(7) = '101' xor '111' = '010' = 2.
MATHEMATICA
a[n_] := BitXor @@ Flatten[ Table[ First[#], {Last[#]} ]& /@ FactorInteger[n] ]; Table[a[n], {n, 1, 84}] (* Jean-François Alcover, Mar 11 2013 *)
PROG
(Haskell)
import Data.Bits (xor)
a072594 = foldl1 xor . a027746_row :: Integer -> Integer
-- Reinhard Zumkeller, Nov 17 2012
(PARI) a(n)=if(n==1, return(1)); my(f=factor(n), t); for(i=1, #f~, if(f[i, 2]%2, t=bitxor(t, f[i, 1]))); t \\ Charles R Greathouse IV, Aug 28 2016
(Python)
from sympy import factorint
from operator import __xor__
from functools import reduce
def a(n): return reduce(__xor__, (f for f in factorint(n, multiple=True))) if n > 1 else 1
print([a(n) for n in range(1, 85)]) # Michael S. Branicky, May 31 2025
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
Reinhard Zumkeller, Jun 23 2002
STATUS
approved
