Representing a for loop with modulus in formal notation

158 Views Asked by At

I have the following section of code I am writing for research. Basically I need to formally represent the mathematical notation behind a set that follows:

for (int i = 1; i < h; i++)
    if (h % i == 0)
        // i is part of the set

I am not very familiar with formal mathematical notation, and was wondering if anyone can help me express this.

Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

The set could be specified like this: $S = \{i : (1 \leq i < h) \land (h ~\%~ i = 0)\}$.