var n=255, divisor = [], i = 3; while(i < n) { if(n % i == 0) divisor.push(i); i = i + 3; } alert(divisor);