Periodic sequence of repeating numbers

Is there a way to generate periodic sequences of groups of repeated numbers with the arithmetic operators $+, \; -, \; \text{mod}$ and min, and max?

Example, let's say I want to map:

$1 \; 2 \; 3 \; 4 \; 5 \; 6 \; 7 \; 8 \; 9 \; 10 \; \ldots$

To $1 \; 1 \; 1 \; 2 \; 2 \; 2 \; 1 \; 1 \; 1 \; 2 \; \ldots$

Or to $1 \; 1 \; 1 \; 2 \; 2 \; 2 \; 3 \; 3 \; 3 \; 1 \; \ldots$

Edit: There is a simple solution with ceil/floor: Let's say I want to repeat groups of n numbers, the following formula generates the sequence:

$[\text{ceiling}(\frac{n}{l}) - 1] \; \text{mod} \; l + 1$

With $l$ the length of the groups and $n$ the $n^{th}$ natural integer. But is it possible to do without division and ceiling or floor?

• Just those three operations or other similar ones such as multiply, divide, and floor / ceiling. I expect that floor and ceiling would be useful. Dec 10 '17 at 14:18
• I edited the question to add the min/max operators, I have found the solution with floor and ceiling but would prefer to do without if possible. Dec 10 '17 at 14:49

For example, to get $1\ 1\ 1\ 2\ 2\ 2\ 3\ 3\ 3\ 1\ 1\ 1\ \ldots$ you note that we have a period of $9$, so first you take $n \bmod 9$. If we start with $n=0$ we then have to map $0-8$ properly and we can do that with an integer divide from the floor function. The result is $1+\lfloor \frac {n \bmod 9}3 \rfloor$.