I use pari most of the time for my computational number theory research. I entered the following: for(x=1,100,print1(eulerphi(n)-1))
which gives the values of φ(n)-1 for integers 1 to 100. Here φ(n) is the number of integers less than n which are relatively prime to n. It gave the following output:
0 0 1 1 3 1 5 3 5 3 ... 65 31 43 23 69 2 43 59 45 71 31 95 41 59 39
(I excluded some integers to make the question short) I want to check if a number is in those numbers. How can I do so?
How to know if a number is in a collection of numbers in pari?
107 views Asked by AudioBubble At
1
You can use function
setsearch
to perform binary search through sorted list. It returns the 1-based index of match or 0 if nothing is found. Your example is here: