%I #30 Oct 30 2022 18:19:59
%S 0,0,1,0,0,2,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,
%T 0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,
%U 0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0
%N Number of inequivalent 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).
%C Two primes are considered equivalent if they differ by multiplication by a unit (+-1, +-i).
%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 Reinhard Zumkeller, <a href="/A055029/b055029.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) = A055028(n)/4.
%F a(n) = 2 if n is a prime = 1 (mod 4); a(n) = 1 if n is 2, or p^2 where p is a prime = 3 (mod 4); a(n) = 0 otherwise. - _Franklin T. Adams-Watters_, May 05 2006
%F a(n) = if n = 2 then 1 else 2*A079260(n) + A079261(A037213(n)). - _Reinhard Zumkeller_, Nov 11 2012
%e There are 8 Gaussian primes of norm 5, +-1+-2i and +-2+-i, but only two inequivalent ones (2+-i).
%t a[n_ /; PrimeQ[n] && Mod[n, 4] == 1] = 2; a[2] = 1; a[n_ /; (p = Sqrt[n]; PrimeQ[p] && Mod[p, 4] == 3)] = 1; a[_] = 0; Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Oct 25 2011, after _Franklin T. Adams-Watters_ *)
%o (Haskell)
%o a055029 2 = 1
%o a055029 n = 2 * a079260 n + a079261 (a037213 n)
%o -- _Reinhard Zumkeller_, Nov 11 2012
%o (PARI) a(n)=if(isprime(n), if(n%4==1, 2, n==2), if(issquare(n, &n) && isprime(n) && n%4==3, 1, 0)) \\ _Charles R Greathouse IV_, Feb 07 2017
%Y Cf. A055025, A055026, A055027, A055028.
%Y Cf. A055664, A055665, A055666, A055667, A055668.
%K nonn,easy,nice
%O 0,6
%A _N. J. A. Sloane_, Jun 09 2000
%E More terms from _Reiner Martin_, Jul 20 2001