# Thread: What equation (sequence) would resolve any number into either odd or even?

1. Entry Level Fresher
Join Date
Jun 2007
Posts
1

## What equation (sequence) would resolve any number into either odd or even?

Hello all,I'm having trouble trying to figure out an equation that will categorize any number to either zero (for even numbers) and one (for odd numbers). For example:0 = 0 (even)1 = 1 (odd)2 = 0 (even)3 = 1 (odd)4 = 0 (even)5 = 1 (odd)6 = 0 (even)7 = 1 (odd)Any help would be much appreciated. Thanks!  Reply With Quote

2. Entry Level Fresher
Join Date
Jun 2007
Posts
1

## Well the typical way is to define a function that has two possible values. i.e.f(x) = 0 (for all x even)f(x) = 1 (for all x odd)This is a perfectly valid function.  Reply With Quote

3. Entry Level Fresher
Join Date
Jun 2007
Posts
1

## well if you take the square root of the even or odd number than the even number will be a whole number or irrational number if you know what i am saying you would know.  Reply With Quote

4. Entry Level Fresher
Join Date
Jun 2007
Posts
1

## The sequence a_n = (1 - (-1)^n)/2 does the job. Just check  Reply With Quote

5. Entry Level Fresher
Join Date
Jun 2007
Posts
3

## With the exception of zero, X-(X+1) would work. Zero would end up being odd even though it is neither odd nor even.  Reply With Quote

6. Entry Level Fresher
Join Date
Jun 2007
Posts
1

## n is even if and only if (-1)^n = 1 help, or no?  Reply With Quote

equation number, odd or even 