I am using a website called dcode to input numbers into the PHI function, and then receive an output of numbers relatively prime with my input.
The website, unfortunately, limits output to just 500 relatively prime numbers. For my testing this is too low, preferably I would like a complete list.
Could anyone recommend a desktop software which does not have such limitations? It can be for either Windows or Linux. I know about Matlab, but was hoping there was already a program which does what I want, without me having to learn a new scripting language.
Best Answer
This is an easily solved problem, and doesn't require any sort of advanced tools. As Peter said, Euler's Totient is only for computing the number of coprimes for a given n. To actually calculate them, I guarantee that website is doing exactly what Peter suggested: checking the GCD of each possibility. That shouldn't take very long.
Here's a complete Python program to do that, for numbers passed as arguments to the script. (i.e. you'd call it like
python3 coprimes.py 47 87
to list the coprimes for, separately,47
and87
). It'll list the results, and then give the quantity and time required to produce them, for each argument in turn.It's quite fast. I tried it with the value
4636436
, which has1987032
coprimes. It took my Linux machine 8 seconds to compute and list them all. And honestly, the time spent printing them to the terminal takes up roughly half of that time.The output: