Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-rosetta/blob/main/exercises/nth-prime/.meta/example.om # omega-rosetta aien-dev/omega-rosetta Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-rosetta / exercises / nth-prime / .meta / example.om` 29 lines ยท 586 bytes Raw Blame History 1 note Exercism-style exercise "nth-prime": https://exercism.org/tracks/python/exercises/nth-prime 2 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 note prime is the n-th prime number (prime 1 is 2), or 0 for n = 0, which has no prime. 4 note Check it with: sh exercise.sh exercises/nth-prime 5 om2 6 fn isprime n ulong to bool 7 d = ulong 2 8 while le mul d d n bound 999999 9 if eq rem n d 0 10 ret false 11 end 12 d = add d 1 13 end 14 ret true 15 end 16 fn prime n ulong to ulong 17 if eq n 0 18 ret 0 19 end 20 c = ulong 0 21 v = ulong 1 22 while lt c n bound 999999 23 v = add v 1 24 if isprime v 25 c = add c 1 26 end 27 end 28 ret v 29 end