Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
