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.