%I #21 Oct 30 2022 18:19:59
%S 0,0,4,0,0,8,0,0,0,4,0,0,0,8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,
%T 0,0,0,8,0,0,0,8,0,0,0,0,0,0,0,4,0,0,0,8,0,0,0,0,0,0,0,8,0,0,0,0,0,0,
%U 0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,8,0,0,0
%N Number of Gaussian primes of norm n.
%C These are the primes in the ring of integers a+bi, a and b rational integers, i = sqrt(-1).
%D R. K. Guy, Unsolved Problems in Number Theory, A16.
%D L. W. Reid, The Elements of the Theory of Algebraic Numbers, MacMillan, NY, 1910, see Chap. V.
%H Seiichi Manyama, <a href="/A055028/b055028.txt">Table of n, a(n) for n = 0..10000</a>
%H <a href="/index/Ga#gaussians">Index entries for Gaussian integers and primes</a>
%F a(n) = 4 * A055029(n). - _Franklin T. Adams-Watters_, May 05 2006
%e There are 8 Gaussian primes of norm 5, +-1 +- 2i and +-2 +- i, but only two inequivalent ones (2 +- i).
%p A055028 := proc(n::integer)
%p local c,a,b ;
%p c := 0 ;
%p for a from -n to n do
%p if issqr(n-a^2) then
%p b := sqrt(n-a^2) ;
%p if GaussInt[GIprime](a+b*I) and a^2+b^2=n then
%p if b = 0 then
%p c := c+1 ; # a+i*b and a-i*b
%p else
%p c := c+2 ; # a+i*b and a-i*b
%p end if;
%p end if;
%p end if;
%p end do:
%p c ;
%p end proc:
%p seq( A055028(n),n=0..50) ; # _R. J. Mathar_, Jul 22 2021
%t a[n_ /; PrimeQ[n] && Mod[n, 4] == 1] = 8; a[2] = 4; a[n_ /; (p = Sqrt[n]; PrimeQ[p] && Mod[p, 4] == 3)] = 4; a[_] = 0; Table[ a[n], {n, 0, 100}] (* _Jean-François Alcover_, Jul 30 2013, after _Franklin T. Adams-Watters_ *)
%Y Cf. A055025-A055029, A055664-... , A295996.
%K nonn,easy,nice
%O 0,3
%A _N. J. A. Sloane_, Jun 09 2000
%E More terms from _Reiner Martin_, Jul 20 2001