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-mv/blob/main/tests/compiler/progs/collatz.osc # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tests / compiler / progs / collatz.osc` 14 lines ยท 440 bytes Raw Blame History 1 // entry: collatz 2 // expect-run: collatz 27 -> 111 3 // expect-run: collatz 1 -> 0 4 // expect-run: collatz 0 -> trap=LOOP_BOUND 5 // Collatz steps with a static bound: very long or endless orbits trap LOOP_BOUND. 6 fn collatz(n0: u32) -> u32 { 7 let mut n: u64 = n0 as u64; 8 let mut steps: u32 = 0; 9 while n != 1 bound 300 { 10 if n % 2 == 0 { n = n / 2; } else { n = 3 * n + 1; } 11 steps = steps + 1; 12 } 13 return steps; 14 }