{"id":1174,"date":"2019-10-25T14:10:37","date_gmt":"2019-10-25T14:10:37","guid":{"rendered":"https:\/\/muthu.co\/?p=1174"},"modified":"2021-05-24T02:40:18","modified_gmt":"2021-05-24T02:40:18","slug":"function-to-get-the-preceding-odd-number-y-for-any-given-number-x","status":"publish","type":"post","link":"http:\/\/write.muthu.co\/function-to-get-the-preceding-odd-number-y-for-any-given-number-x\/","title":{"rendered":"Function to get the preceding odd number (y) for any given number (x)"},"content":{"rendered":"\n
For any function,<\/p>\n\n\n\n
We want, for every value of x, return the corresponding odd number. If x is odd then return it as it is, else return the next number. This can easily be done using a computer program by checking if the number is odd or even. But if you had to find a general formula we would need the help of some basic maths.<\/p>\n\n\n\n
Let’s decompose our above function and see what we can extract.<\/p>\n\n\n\n