DEV Community

Wox Tox Fox
Wox Tox Fox

Posted on • Updated on

How calculation affects the evens and odds

Odds and Evens

Numbers could either be odd or even. Arithmetic operations we do like addition, subtraction, multiplication and division would have an effect on the number being even or odd. That's what we are going to study.

Even numbers are the numbers which are multiples of 2. Odd numbers are the numbers which are NOT multiples of 2. Odd numbers leave a remainder when its divided by 2.

Consider arbitrary integral constants a and b,

Even numbers have a form of 2a

Odd numbers have a form of 2a + 1


Addition

even + even

 = 2a + 2b

 = 2(a + b)

 = even

even + odd

 = 2a + 2b + 1

 = 2(a + b) + 1

 = odd

odd + odd

 = 2a + 1 + 2b + 1

 = 2 + 2a + 2b

 = 2(a + b + 1)

 = even


Subtraction

We could leverage the fact that negative of an even is still even. The same goes for odd numbers. So Addition rules naturally apply for

Subtraction rules.


Multiplication

even ✕ even

 = 2a ✕ 2b

 = 4ab

 = 2(2ab)

 = even

even ✕ odd

 = 2a ✕ (2b + 1)

 = 4ab + 2a = 2(2ab + a)

 = even

odd ✕ odd

 = (2a + 1) ✕ (2b + 1)

 = 4ab + 2a + 2b + 1

 = 2(2ab + a + b) + 1

 = odd


Division

Divisions become scary irrational fast. They cant be classified as even or odds. I'm skipping it because Its not the territory I'm are going to step in.


Exponents

Exponents are just multiplications over and over again. So we could use the findings from above. But it only works for positive non-zero n.

even ^ n

 = even ✕ even ✕ even ✕ ... n times

 = even

odd ^ n

 = odd ✕ odd ✕ odd ✕ ... n times

 = odd


Factorial

Factorial of a number is simply the product of the series from that number to 1. Hence it also contains 2 in the product chain. It makes it even! But it only works when n is greater than 1.

n!

 = n ✕ (n − 1) ✕ (n − 2) ✕ ... ✕ 2 ✕ 1

 = 2 (n ✕ (n − 1) ✕ (n − 2) ✕ ... ✕ 3 ✕ 1)

 = its even

Conclusion

+ even odd
even even odd
odd odd even
even odd
even even odd
odd odd even
even odd
even even even
odd even odd

For non zero positive powers,

^ even odd
even even even
odd odd odd

Factorials,

n n!
greater than 1 even
not greater than 1 odd

Top comments (0)