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/tools/exp445/arms/examples/power_mod/program.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 / tools / exp445 / arms / examples / power_mod / program.osc` 16 lines ยท 377 bytes Raw Blame History 1 fn mod(a: u64, b: u64, m: u64) -> u64 { 2 return a * b % m; 3 } 4 5 fn power_mod(b: u32, e: u32, m: u32) -> u32 { 6 let mm: u64 = m as u64; 7 let mut r: u64 = 1 % mm; 8 let mut x: u64 = (b as u64) % mm; 9 let mut k: u32 = e; 10 while k > 0 bound 40 { 11 if k % 2 == 1 { r = mod(r, x, mm); } 12 x = mod(x, x, mm); 13 k = k / 2; 14 } 15 return r as u32; 16 }