interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / si / rosetta / exercises / sum-of-multiples / .meta / example.om

24 lines · 604 bytes Raw Blame History
1note Exercism-style exercise "sum-of-multiples": https://exercism.org/tracks/python/exercises/sum-of-multiples
2note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3note sum is the sum of every distinct number below limit that is a multiple of at least one of the
4note factors fs (a factor 0 has no multiples here).
5note Check it with: sh exercise.sh exercises/sum-of-multiples
6om2
7fn sum fs view ulong * limit ulong to ulong
8t = ulong 0
9for m ulong limit
10hit = false
11for j ulong len fs
12f = get fs j
13if ne f 0
14if eq rem m f 0
15hit = true
16end
17end
18end
19if and hit ne m 0
20t = add t m
21end
22end
23ret t
24end