Wolfram Research

Function Repository Resource:

CoprimeIntegerList (2.1.0) current version: 3.0.0 »

Source Notebook

Return a list of positive integers coprime to a given integer

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["CoprimeIntegerList"][n]

gives a list of the positive integers less than n that are coprime to n.

Details

Two integers are considered coprime (or relatively prime) if they share no divisors other than 1.

Examples

Basic Examples (2) 

Find the integers less than 12 that are coprime to 12:

In[1]:=
ResourceFunction["CoprimeIntegerList"][12]
Out[1]=

Coprime integer list discards the sign of its input:

In[2]:=
ResourceFunction["CoprimeIntegerList"][-16]
Out[2]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 3.0.0 – 23 March 2023
  • 2.1.0 – 12 May 2021
  • 2.0.0 – 24 January 2020
  • 1.0.0 – 15 September 2019

Related Resources

License Information