%I #40 Sep 30 2024 12:55:42
%S 0,2,1,4,2,3,1,6,2,4,1,5,2,3,3,8,2,4,1,6,2,3,1,7,4,4,3,5,2,5,1,10,2,4,
%T 3,6,2,3,3,8,2,4,1,5,4,3,1,9,2,6,3,6,2,5,3,7,2,4,1,7,2,3,3,12,4,4,1,6,
%U 2,5,1,8,2,4,5,5,2,5,1,10,4,4,1,6,4,3,3,7,2,6,3,5,2,3,3,11,2,4,3,8,2,5,1,8
%N Total number of factors in a factorization of n into Gaussian primes.
%C a(n)+1 is also the total number of factors in a factorization of n+n*i into Gaussian primes. - _Jason Kimberley_, Dec 17 2011
%C Record high values are at a(2^k) = 2*k for k = 0, 1, 2, ... . - _Bill McEachen_, Oct 11 2022
%H T. D. Noe, <a href="/A078458/b078458.txt">Table of n, a(n) for n = 1..10000</a>
%H Michael Somos, <a href="/A078458/a078458.txt">PARI program for finding prime decomposition of Gaussian integers</a>.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/GaussianPrime.html">Gaussian Prime</a>.
%H <a href="/index/Ga#gaussians">Index entries for Gaussian integers and primes</a>.
%F Fully additive with a(p)=2 if p=2 or p mod 4=1 and a(p)=1 if p mod 4=3. - _Vladeta Jovovic_, Jan 20 2003
%F a(n) depends on the number of primes of the forms 4k+1 (A083025) and 4k-1 (A065339) and on the highest power of 2 dividing n (A007814): a(n) = 2*A007814(n) + 2*A083025(n) + A065339(n). - _T. D. Noe_, Jul 14 2003
%e 2 = (1+i)*(1-i), so a(2) = 2; 9 = 3*3, so a(9) = 2.
%e a(1006655265000) = a(2^3*3^2*5^4*7^5*11^3) = 3*a(2)+2*a(3)+4*a(5)+5*a(7)+3*a(11) = 3*2+2*1+4*2+5*1+3*1 = 24. - _Vladeta Jovovic_, Jan 20 2003
%t Join[{0}, Table[f = FactorInteger[n, GaussianIntegers -> True]; cnt = Total[Transpose[f][[2]]]; If[MemberQ[{-1, I, -I}, f[[1, 1]]], cnt--]; cnt, {n, 2, 100}]] (* _T. D. Noe_, Mar 31 2014 *)
%t a[n_]:=PrimeOmega[n, GaussianIntegers -> True]; Array[a,104] (* _Stefano Spezia_, Sep 29 2024 *)
%o (PARI) a(n)=my(f=factor(n)); sum(i=1,#f~,if(f[i,1]%4==3,1,2)*f[i,2]) \\ _Charles R Greathouse IV_, Mar 31 2014
%Y Cf. A078908-A078911, A007814, A065339, A083025, A086275 (number of distinct Gaussian primes in the factorization of n).
%Y Cf. A239626, A239627 (including units).
%K nonn,easy
%O 1,2
%A _N. J. A. Sloane_, Jan 11 2003
%E More terms from _Vladeta Jovovic_, Jan 12 2003