Working with functions using modulo operator I have a function defined in a computer program that I would like to study mathematically:
$y = \frac{x}{2} + (\frac{5}{2}x + 1)*(x\%2)$
This function is used on strictly positive integers and also returns integers only.
The main issue is that it's using the modulo operator ($\%$) as part of the function calculation, not as in a modular equation, and I have no clue how to translate into a formula that is suitable for mathematical analysis...
I have found various topic related to modulo/floor and how to translate them into mathematical form:

*

*Solving equations involving modulo operator

*Solving modular equations with a variable in the modulus divisor

*How to represent the floor function using mathematical notation?
But none of them seems to match this particular situation.
Also, to clarify what I mean by "studiy mathematically", it would be for example to determine the range of output values if input values are taken in a given range, or to determine limits/periodicity if this function was called recursively.

x % 2 is equivalent to $\frac{1-(-1)^x}{2}$.  On positive integer $x$, x % 2${}\in \{0,1\}$.  (Some programming languages do stupid things for negative $x$.  Example.)  Consequently, you have
$$  y = \begin{cases}
x/2 &, \text{$x$ even}  \\
3x + 1 &, \text{$x$ odd}
\end{cases}  \text{.}  $$
The Collatz conjecture covers the study of this function under recursion.
