<s>[INST] function checkPrimes(numbers){
    for(let i=0; i<numbers.length; i++){
        let isPrime = true;
        for(let j=2; j<numbers[i]; j++){
            if(numbers[i] % j === 0){
                isPrime = false;
                break;
            }
        }
        if(isPrime && numbers[i] > 1){
            console.log(`${numbers[i]} is a prime number`);
        }
    }
}
checkPrimes([2,3,4,5,6,7,8,9,10,11,12,13])

This code snippet is written in JavaScript. The function checkPrimes() is designed to check whether numbers in the input array are prime or not. However, the time complexity of this function is O(n^2). How do you reduce the time complexity to O(n*sqrt(n))?[/INST]