Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function named minDistance that returns the smallest distance between two nontrivial factors of a number. For example, consider 6 3 . Its non
Write a function named minDistance that returns the smallest distance between two nontrivial factors of a number. For example, consider Its nontrivialfactors are and
Thus minDistance would return because the smallest distance between any two nontrivial
factors is As another example, minDistance would return because has
only one nontrivial factor: Thus the smallest distance between any two nontrivial factors is
Note that minDistance would return since has no nontrivial factors.
The function signature is
int minDistanceint n
NB You should only answer in Java
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