Question: I'm trying to disable the checkbox for specific field on the base of condition,

```
if (value == 3)
ko.observable(value);

```

Answer: 
An *actual* NumPy sieve of Eratosthenes looks like this:

```
def sieve(n):
    flags = numpy.ones(n, dtype=bool)
    flags[0] = flags[1] = False
    for i in range(2, n):
        # We could use a lower upper bound for this loop, but I don't want to bother with
        # getting the rounding right on the sqrt handling.
        if flags[i]:
            flags[i*i::i] = False
    return numpy.flatnonzero(flags)

```

It maintains an array of "possibly prime" flags and directly unsets the flags corresponding to multiples of primes, without needing to test divisibility, especially for numbers that aren't divisible by the prime currently being handled.

What you're doing is trial division, where you just go through and test whether numbers are divisible by candidate divisors. Even a good implementation of trial division needs to do more operations, and more expensive operations, than a sieve. Your implementation does even more work than that, because it considers non-prime candidate divisors, and because it keeps performing divisibility tests for numbers it should already know are prime.
I decided to play with this and created a further optimized NumPy version posted by *@user2357112 supports Monica* that uses the Numba JIT to speed things up.

```
import numba
import numpy
import timeit
import datetime 

@numba.jit(nopython = True, parallel = True, fastmath = True, forceobj = False)
def sieve (n: int) -> numpy.ndarray:
    primes = numpy.full(n, True)
    primes[0], primes[1] = False, False
    for i in numba.prange(2, int(numpy.sqrt(n) + 1)):
        if primes[i]:
            primes[i*i::i] = False
    return numpy.flatnonzero(primes)

if __name__ == "__main__":

    timestart = timeit.default_timer()
    print(sieve(1000000000))
    timestop = timeit.default_timer()
    timedelta = (timestop - timestart)
    print(f"Time Elapsed: {datetime.timedelta(seconds = timedelta)}")

else:
    pass

```

On my laptop, I sieve out the primes in the first 1 billion (`1e9`) natural numbers in `0:00:10.378686` seconds. The JIT provides at least an order of magnitude of performance here; the next fastest answer at the time of writing took `0:01:27.059963` minutes. Sadly, I don't have an Nvidia GPU and Cuda on this system (Mac), otherwise I'd have used that.