Racket 81 bytes - (let loop((c 2))(cond[(> c(sqrt n))#t][(= 0(modulo n c))#f][(loop(+ 1 c))])) Ungolfed: (define (f n) (let loop ((c 2)) (cond [(> c (sqrt n)) #t] [(= 0 (modulo n c)) #f] [else (loop (add1 c))] ))) Following version is longer but more efficient for checking larger numbers since it keeps & uses previously found prime numbers: (λ(N)(define(p n(o'(2))(c 2))(cond[(> c n)o][(ormap(λ(x)(= 0(modulo c x)))o) (p n o(+ 1 c))][else(p n(cons c o)(+ 1 c))]))(= N(car(p N)))) Ungolfed version: (p=subfunction to build prime number list till n; o= list of prime numbers found; c=current number being checked) (define f (λ (N) (define (p n (o '(2)) (c 2)) (cond [(> c n) o] [(ormap (lambda(x) (= 0 (modulo c x))) o) (p n o (add1 c)) ] [else (p n (cons c o) (add1 c))])) (= N (first (p N))))) Testing: (f 109) (f 10) (f 11) (f 12) (f 13) (f 49) (f 43) (f 57) (f 47) Output: #t #f #t #f #t #f #t #f #t