OFFSET
1,3
COMMENTS
This definition of the totient function for Gaussian integers preserves many of the properties of the usual totient function: (1) it is multiplicative: if gcd(z1,z2)=1, then phi(z1*z2)=phi(z1)*phi(z2), (2) phi(z^2)=z*phi(z), (3) z=Sum_{d|z} phi(d) for properly selected divisors d and (4) the congruence z=1 (mod phi(z)) appears to be true only for Gaussian primes. The first negative term occurs for n=130=2*5*13, the product of the first three primes which are not Gaussian primes.
Note that this definition of the Euler totient function for Gaussian integers is different to that in, for example, A079458, A394288, and A391110. In the present sequence it is defined as a function f : Z[i] -> Z[i], where f(z) = Product_{p^e|z} (p - 1) * p^(e-1), for p a Gaussian prime. In A079458, A394288, and A391110, the generalized totient function phi_i : Z[i] -> Z is defined as phi_i(z) = Product_{p^e|z} (N(p) - 1) * N(p^(e-1)), where N(p) is the norm of p, and it gives the number of elements in the group of units (Z[i]/(z))*. - Miles Englezou, Apr 25 2026
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000 (terms 1..1000 from T. D. Noe)
Eric Weisstein's World of Mathematics, Totient Function
FORMULA
Let a nonzero Gaussian integer z have the factorization u*p_1^e_1*...*p_m^e_m, where u is a unit (1, i, -1, -i), the p_k are Gaussian primes in the first quadrant and the e_k positive integers. Then we define phi(z) = u*Product_{k=1..m} (p_k-1)*p_k^(e_k-1).
MATHEMATICA
phi[z_] := Module[{f, k, prod}, If[Abs[z]==1, z, f=FactorInteger[z, GaussianIntegers->True]; If[Abs[f[[1, 1]]]==1, k=2; prod=f[[1, 1]], k=1; prod=1]; Do[prod=prod*(f[[i, 1]]-1)f[[i, 1]]^(f[[i, 2]]-1), {i, k, Length[f]}]; prod]]; Re[Table[phi[n], {n, 100}]]
PROG
(PARI) CEulerPhi(z)={my(f=factor(z, I)); prod(i=1, #f~, my([p, e]=f[i, ]); if(norm(p)==1, p^e, (p-1)*p^(e-1)))}
a(n)=real(CEulerPhi(n)) \\ Miles Englezou, Apr 25 2026
CROSSREFS
KEYWORD
nice,sign
AUTHOR
T. D. Noe, Jan 26 2005
STATUS
approved
