Would this function be correct?

30 Views Asked by At

I want to express a function that for any x input, it outputs the nearest EVEN integer less than or equal to x.

Would $g(x) = \{ \lfloor x \rfloor : 2 \mid x \} $ do the job properly?

Read: $g(x)$ is the lowest integer not greater than x, such that 2 divides x.

Usage: $g(5)$ would floor 5 to 5 but as 2 does not divide 5, it would floor it to the nearest integer not greater than 5 which does, which is 4...?

1

There are 1 best solutions below

1
On BEST ANSWER

Try $g(x) = 2\left\lfloor \dfrac{x}{2} \right\rfloor$.