Question
Write a java method that returns the largest n-digit coprime for a given integer. The integer for which the largest co-prime is being searched is
Write a java method that returns the largest n-digit coprime for a given integer. The integer for which the largest co-prime is being searched is passed as the first argument to the method and the second argument is the number of digits. In case, an n-digit coprime is not possible, -1 is returned.
For all other error situations, return -2. Cannot use for loops in this question; use while or do-while.
Cannot use any Math libraries in this method.
Cannot use the system.exit(0) anywhere in the method
Cannot use input/output in method (use main to test)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started