Even set rules:
Declarations:
π₯ β β€
π¦ β β€
π§ = π₯ Γ· 2
Proprieties:
βπ¦ β β€ (2π¦ = π₯)
π§ β β€
Odd set rules:
Declarations:
π₯ β β€
π¦ β β€
π§ = π₯ Γ· 2
Proprieties:
βπ¦ β β€ (2π¦ Β± 1 = π₯)
π§ β β€
Alternative 1:
You can also write the number in Base 2 and check the least significant bit. If the least significant bit is 1, then it is odd. If the least significant bit is 0, then it is even.
Alternative 2:
You can also write the number in base 10. If the units digit is 1, 3, 5, 7 or 9, then it is odd. If it is 2, 4, 6, 8 or 0, then it is even.
Trivia:
For any number π¦ written in base(π₯) such that π₯ is even, π₯ β₯ 2, π₯ β β and all digits in that base are all integers over or equal to 0 up until π₯ - 1, you can simply check whether the units digit of π¦ is even or odd.
For any number π¦ written in base(π₯) such that π₯ is odd, π₯ β₯ 3, π₯ β β and all digits in that base are all integers over or equal to 0 up until π₯ - 1, you must sum all of its digits. Let the result be called π§. If π§ < π₯, check whether π§ is equal to any number that can be represented by 2π such that π is an integer over or equal to 0 up until (π₯ - 1). If π§ β₯ π₯, repeat this process up until π§ < π₯.











0 comments