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.

A072594 In prime factorization of n replace multiplication with bitwise logical 'xor'.

This page as a plain text file.
%I A072594 #18 May 31 2025 19:48:04
%S A072594 1,2,3,0,5,1,7,2,0,7,11,3,13,5,6,0,17,2,19,5,4,9,23,1,0,15,3,7,29,4,
%T A072594 31,2,8,19,2,0,37,17,14,7,41,6,43,11,5,21,47,3,0,2,18,13,53,1,14,5,16,
%U A072594 31,59,6,61,29,7,0,8,10,67,17,20,0,71,2,73,39,3,19,12,12,79,5,0,43,83,4
%N A072594 In prime factorization of n replace multiplication with bitwise logical 'xor'.
%C A072594 n is prime iff a(n)=n;
%C A072594 for primes p, k>0: a(p^k)=p*(k mod 2);
%C A072594 for m>1: a(m^2)=0, see A072595.
%C A072594 a(A127812(n)) = n and a(m) <> n for m < A127812(n).
%H A072594 R. Zumkeller, <a href="/A072594/b072594.txt">Table of n, a(n) for n = 1..10000</a>
%e A072594 a(35) = a(5*7) = a(5) 'xor' a(7) = '101' xor '111' = '010' = 2.
%t A072594 a[n_] := BitXor @@ Flatten[ Table[ First[#], {Last[#]} ]& /@ FactorInteger[n] ]; Table[a[n], {n, 1, 84}] (* _Jean-François Alcover_, Mar 11 2013 *)
%o A072594 (Haskell)
%o A072594 import Data.Bits (xor)
%o A072594 a072594 = foldl1 xor . a027746_row :: Integer -> Integer
%o A072594 -- _Reinhard Zumkeller_, Nov 17 2012
%o A072594 (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
%o A072594 (Python)
%o A072594 from sympy import factorint
%o A072594 from operator import __xor__
%o A072594 from functools import reduce
%o A072594 def a(n): return reduce(__xor__, (f for f in factorint(n, multiple=True))) if n > 1 else 1
%o A072594 print([a(n) for n in range(1, 85)]) # _Michael S. Branicky_, May 31 2025
%Y A072594 Cf. A072591, A072593, A027746, A178910.
%K A072594 nonn,nice
%O A072594 1,2
%A A072594 _Reinhard Zumkeller_, Jun 23 2002