Function Repository Resource:

GaussianIntegerQ

Source Notebook

Determine if a number is a Gaussian integer

Contributed by: Arnoud Buzing

ResourceFunction["GaussianIntegerQ"][z]

gives True is z is a Gaussian integer and False otherwise.

Details and Options

A Gaussian integer is a number whose real and imaginary parts are both integers.

Examples

Basic Examples (4) 

Zero is a Gaussian integer:

In[1]:=
ResourceFunction["GaussianIntegerQ"][0]
Out[1]=

Any integer is a Gaussian integer:

In[2]:=
ResourceFunction["GaussianIntegerQ"][42]
Out[2]=

A complex number with integer real and imaginary parts is a Gaussian integer:

In[3]:=
ResourceFunction["GaussianIntegerQ"][1 + I]
Out[3]=

Non-integer numbers are not Gaussian integers:

In[4]:=
ResourceFunction["GaussianIntegerQ"][1.2]
Out[4]=
In[5]:=
ResourceFunction["GaussianIntegerQ"][2 + \[Pi] I]
Out[5]=

Publisher

Arnoud Buzing

Version History

  • 1.0.0 – 29 April 2020

License Information