login
Sum of (2 - p mod 4) for all prime factors p of n (with repetition).
8

%I #30 Jun 17 2024 07:15:30

%S 0,0,-1,0,1,-1,-1,0,-2,1,-1,-1,1,-1,0,0,1,-2,-1,1,-2,-1,-1,-1,2,1,-3,

%T -1,1,0,-1,0,-2,1,0,-2,1,-1,0,1,1,-2,-1,-1,-1,-1,-1,-1,-2,2,0,1,1,-3,

%U 0,-1,-2,1,-1,0,1,-1,-3,0,2,-2,-1,1,-2,0,-1,-2,1,1,1,-1,-2,0,-1,1,-4,1,-1,-2,2,-1,0,-1,1

%N Sum of (2 - p mod 4) for all prime factors p of n (with repetition).

%C a(n) = {number of primes of the form 4k+1 dividing n} minus {number of primes of the form 4k+3 dividing n}, both counted with multiplicity. - _Antti Karttunen_, Feb 03 2016, after the formula.

%H Reinhard Zumkeller, <a href="/A079635/b079635.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A083025(n) - A065339(n).

%F Other identities. For all n >= 1:

%F a(A267099(n)) = -a(n). - _Antti Karttunen_, Feb 03 2016

%F Totally additive with a(2) = 0, a(p) = 1 if p == 1 (mod 4), and a(p) = -1 if p == 3 (mod 4). - _Amiram Eldar_, Jun 17 2024

%e a(55) = a(5*11) = (2 - 5 mod 4)+(2 - 11 mod 4) = (2-1)+(2-3) = (1)+(-1) = 0.

%p f:= proc(n) local t;

%p add(t[2]*(2-(t[1] mod 4)), t=ifactors(n)[2])

%p end proc:

%p map(f, [$1..100]); # _Robert Israel_, Feb 05 2016

%t f[n_]:=Plus@@((2-Mod[#[[1]],4])*#[[2]]&/@If[n==1,{},FactorInteger[n]]); Table[f[n],{n,100}] (* _Ray Chandler_, Dec 20 2011 *)

%o (Haskell)

%o a079635 1 = 0

%o a079635 n = sum $ map ((2 - ) . (`mod` 4)) $ a027746_row n

%o -- _Reinhard Zumkeller_, Jan 10 2012

%o (Scheme) (define (A079635 n) (- (A083025 n) (A065339 n))) ;; _Antti Karttunen_, Feb 03 2016

%Y Cf. A065339, A083025.

%Y Cf. A072202 (indices of zeros), A268379 (of strictly positive terms), A268380 (of negative terms), A268381 (of nonnegative terms).

%Y Cf. A027746, A267099.

%Y Cf. A005094 (difference when counting only distinct primes).

%K sign

%O 1,9

%A _Reinhard Zumkeller_, Jan 30 2003

%E Edited by _Ray Chandler_, Dec 20 2011