I need to drawraw a flowchart for a algorithm which finds the largest proper divisor of n (that is, the largest m such that 1 <= m < n and m evenly divides n). You can use the % operator: recall that n % m is the remainder when n is divided by m.
I need to test it on numbers such as 8,876,044,532,8 98,802,067 and 2,305,843,009,2 13,693,951..
so far I have
public class xc14 {
public static long maxDiv(long n )
{
int m = 2;
while(m <= (int) Math.sqrt(n))
{
// ...
}
return 1;
}
can anyone help?
I need to test it on numbers such as 8,876,044,532,8 98,802,067 and 2,305,843,009,2 13,693,951..
so far I have
public class xc14 {
public static long maxDiv(long n )
{
int m = 2;
while(m <= (int) Math.sqrt(n))
{
// ...
}
return 1;
}
can anyone help?
Comment