login
The arithmetic derivative of n, modulo 2.
18

%I #33 Jan 16 2023 21:54:08

%S 0,0,1,1,0,1,1,1,0,0,1,1,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,0,1,1,1,0,0,

%T 1,0,0,1,1,0,0,1,1,1,0,1,1,1,0,0,1,0,0,1,1,0,0,0,1,1,0,1,1,1,0,0,1,1,

%U 0,0,1,1,0,1,1,1,0,0,1,1,0,0,1,1,0,0,1,0,0,1,1,0,0,0,1,0,0,1,1,1,0,1,1,1,0

%N The arithmetic derivative of n, modulo 2.

%H Reinhard Zumkeller, <a href="/A165560/b165560.txt">Table of n, a(n) for n = 0..10000</a>

%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>

%F a(n) = A003415(n) mod 2.

%F a(n) = (1-(-1)^n')/2.

%F a(A235991(n)) = 1 and a(A235992(n)) = 0. - _Reinhard Zumkeller_, Mar 11 2014

%F a(n) = 1 - A358680(n) = A358680(n) - A359792(n) = A358771(n) + A358773(n). - _Antti Karttunen_, Jan 16 2023

%p with(numtheory);

%p P:=proc(i)

%p local f,n,p,pfs;

%p for n from 0 by 1 to i do

%p pfs:=ifactors(n)[2]; f:=n*add(op(2,p)/op(1,p),p=pfs);

%p print(1/2*(1-(-1)^f));

%p od;

%p end:

%p P(1000);

%t d[0] = d[1] = 0; d[n_] := n*Total[f = FactorInteger[n]; f[[All, 2]]/f[[All, 1]] ]; a[n_] := Mod[d[n], 2]; Table[a[n], {n, 0, 104}] (* _Jean-François Alcover_, Apr 22 2015 *)

%o (Haskell)

%o a165560 = flip mod 2 . a003415 -- _Reinhard Zumkeller_, Mar 11 2014

%o (Python)

%o from sympy import factorint

%o def A165560(n): return int(n&3==2 or (n&1 and sum(factorint(n).values())&1)) # _Chai Wah Wu_, Nov 04 2022

%o (PARI) A165560(n) = if(n<=1, 0, my(f=factor(n)); (n*sum(i=1, #f~, f[i, 2]/f[i, 1]))%2); \\ _Antti Karttunen_, Nov 04 2022

%Y Characteristic function of A235991, whose complement A235992 gives the positions of 0's.

%Y Cf. A000035, A003415, A347870 [= a(sigma(n))], A353493, A353494, A353495, A358680 (one's complement), A359792.

%Y Sum of A358771 and A358773.

%K easy,nonn

%O 0,1

%A _Paolo P. Lava_ & _Giorgio Balzarotti_, Sep 24 2009

%E Entries checked by _R. J. Mathar_, Oct 07 2009