omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / bench / inference_cost / tasks / task10 / reference.om
| 1 | fn is_prime_u32 n uint to uint |
| 2 | if lt n 2 |
| 3 | ret 0 |
| 4 | end |
| 5 | if eq n 2 |
| 6 | ret 1 |
| 7 | end |
| 8 | if eq (and n 1) 0 |
| 9 | ret 0 |
| 10 | end |
| 11 | d = ulong 3 |
| 12 | ln = ulong n |
| 13 | while le (mul d d) ln |
| 14 | if eq (rem ln d) 0 |
| 15 | ret 0 |
| 16 | end |
| 17 | d = add d 2 |
| 18 | end |
| 19 | ret 1 |
| 20 | end |