Question: 9) Write a program that prompts the user to enter an integer, n, in between 1 and 1012 and calculates (n). (Please write your program

9) Write a program that prompts the user to enter an integer, n, in between 1 and 1012 and calculates (n). (Please write your program in either python or Java, which supports large integers. Please submit phi.py or phi.java.)

10) Using your program from question 1, write a program that determines if (a) an input value in between 1 and 1012 is prime, and (b) if so, asks the user to enter an integer in between 1 and the prime number minus 1 and determines if that value is a primitive root. Your program should work as follows: Calculate each unique prime factor qi of p 1, and calculate x(p-1)/qi mod p for each qi. If none of these are equal to 1, then x is a primitive root. (Please write your program in either python or Java, which supports large integers. Please submit primroot.py or primroot.java)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!