All pastes #50296 Raw Edit

Someone

public java v1 · immutable
#50296 ·published 2006-04-20 23:09 UTC
rendered paste body
	/**	 * Returns the greatest integer divisor of n less than sqrt(n). returns 1 if	 * n is prime	 */	public static int divisors(int n) {		int sqrt = (int) Math.floor(Math.sqrt(n));		for (int x = sqrt; x > 0; x--) {			if ((n % x) == 0)				return x;		}		return 1;	}