FreedAI Example Run this prompt →
prompt
Write a Python function to check if a number is prime.
assistant
def is_prime(n):
    if n < 2:
        return False
    for d in range(2, int(n ** 0.5) + 1):
        if n % d == 0:
            return False
    return True

It checks divisibility only up to the square root of n, which is enough because any factor larger than sqrt(n) has a paired factor smaller than sqrt(n).
92 tokens · est. cost $0.000000 · generated by FreedAI