# Looking for a function

#### Mr_Random_Guy

##### New member
I want a mathematical function (floor/ceiling etc. are fine but not piecewise) which does the following:
If the input is odd, just return that number i.e f(2n+1) = 2n+1
If the input is even return the odd number one less than it i.e f(2n) = 2n-1

So for example f(4)=3, f(3)=3

#### JeffM

##### Elite Member
I want a mathematical function (floor/ceiling etc. are fine but not piecewise) which does the following:
If the input is odd, just return that number i.e f(2n+1) = 2n+1
If the input is even return the odd number one less than it i.e f(2n) = 2n-1

So for example f(4)=3, f(3)=3
Did you read our guidelines at

Hint: $$\displaystyle n \in \mathbb Z \implies n - 2 * \left \lfloor \dfrac{n}{2} \right \rfloor = \text {WHAT?}.$$