def get_solution(): """ Solves the problem and returns the answer. NOTE: At the time of writing, JAX does not enable 64 bit operations by default, required to solve this problem. Check the configuration at the top of this script. """ max_prime = np.sqrt(NUMBER).astype(int) # No point looking after this one primes_list = jnp.asarray(get_all_primes(max_prime=max_prime), dtype=jnp.int32) return compute_solution(NUMBER, primes_list)
def get_solution(): """ Solves the problem and returns the answer. """ primes_list = get_all_primes(max_prime=MAX_PRIME) triangle_sequence = np.asarray(triangle_up_to(value=MAX_INT), dtype=int) n_combinations = compute_solution( primes_list=jnp.asarray(primes_list, dtype=jnp.int32), triangle_sequence=jnp.asarray(triangle_sequence, dtype=jnp.int32)).astype(int) # Easier to do masks outside jax :D return min(triangle_sequence[n_combinations > 500])
def get_solution(): """ Solves the problem and returns the answer. """ return np.sum(get_all_primes(max_prime=2000000))
def get_solution(): """ Solves the problem and returns the answer. """ primes_list = jnp.asarray(get_all_primes(max_prime=MAX_NUMBER), dtype=jnp.int32) return compute_solution(MAX_NUMBER, primes_list)
def get_solution(): """ Solves the problem and returns the answer. """ return get_all_primes(n_primes=10001)[-1]