#!/usr/bin/ruby

func is_prime(Number _ (2))                   { true }
func is_prime(Number _ { _ <= 1 || !(_ & 1)}) { false }
func is_prime(Number a) { range(3, a.isqrt) -> any { a %% _ } -> not }

assert_eq(
    (0..50).grep { is_prime(_) },
    [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
)

say "** Test passed!";
