# Reference Request: Greatest Even (Odd) Integer function

This probably isn't the most important question, but I'm working on something where I've found it convenient to define the following two functions (on the integers): $$I_o(q):= \begin{cases} q & q \text{ is odd } \\ q-1 & q \text{ is even} \end{cases} \qquad \text{ and } \qquad I_e(q):= \begin{cases} q & q \text{ is even } \\ q-1 & q \text{ is odd} \end{cases}.$$

So $I_o(q)$ is just the largest odd number less than or equal to $q$ and $I_e(q)$ is the same, except for even numbers. I feel that I've seen this function before with a notation similar as to that of floor, but I've had little luck googling it. So I was curious if there was a common notation for this function.

-

You have

$$I_o(q) = 2 \left\lfloor \frac{q-1}{2} \right\rfloor + 1 = \left\{ \begin{array}{lc} q & q \text{ is odd} \\ q-1 & q \text{ is even} \end{array} \right.$$

Similarly,

$$I_e(q) = 2 \left\lfloor \frac{q}{2} \right\rfloor.$$

-
This gives a formula for the functions, but OP was asking for a common notation (if there is one). –  Gerry Myerson Jul 29 '11 at 6:12

I don't know if I'd call this common notation, but Microsoft Office seems to have a function EVEN(x) that rounds $x$ up to the nearest even integer. Of course, Microsoft has a strange definition of "up", as EVEN(-1) is -2, not 0. See this MS Office link.

-