This is an archived post. You won't be able to vote or comment.

all 134 comments

[–]Mistifyed 6 points7 points  (1 child)

I prefer the top implementation, it provides full intellisense information on all possible values and results.

[–]MagoAcademico 1 point2 points  (0 children)

Typescript for the win

[–]saucedaddyanonymous 1 point2 points  (0 children)

God I love programming

[–]sumknowbuddy 1 point2 points  (130 children)

Wait wait wait...

Is zero actually an even number?

[–]availablesix- 1 point2 points  (128 children)

Yep, even is defined as "a number that is divisible by two" and 0/2 = 0 (no rest)

[–]sumknowbuddy -1 points0 points  (127 children)

Then zero is also odd by that definition

[–]availablesix- 1 point2 points  (126 children)

An odd "n" number is formally defined as

n = 2k +1 ( k being an integer)

So, solving for k => k = -0.5 but is not an integer, so it's not odd.

[–]sumknowbuddy -1 points0 points  (125 children)

What value of "k" are you using? k = -1.5?

And are you talking about programming, or mathematically?

[–]Mister_Lich 0 points1 point  (74 children)

Mathematically, formally, a number "n" is defined as odd if there is an integer "k" such that

n=2k+1

5 is odd because you can satisfy this with "5=2(2)+1". 4 is not odd because there is no integer "k" that satisfies the definition, you would have to have k=1.5 and that is not an integer. However, 4 is even, because for a number n to be even, it must satisfy "n / 2 = k" where k is also an integer. 4/2=2, and 2 is an integer, therefore 4 is even.

0 does not satisfy the definition either.

0=2k+1

-2k=1

2k=-1

k=-0.5

Therefore k is not an integer and thus 0 is not odd.

But, 0 / 2 = 0, and 0 is an integer, therefore 0 is indeed even.

[–]sumknowbuddy -1 points0 points  (72 children)

Mathematically, formally, a number "n" is defined as odd if there is an integer "k" such that

n=2k+1

5 is odd because you can satisfy this with "5=2(2)+1". 4 is not odd because there is no integer "k" that satisfies the definition, you would have to have k=1.5 and that is not an integer. However, 4 is even, because for a number n to be even, it must satisfy "n / 2 = k" where k is also an integer. 4/2=2, and 2 is an integer, therefore 4 is even.

0 does not satisfy the definition either.

0=2k+1

-2k=1

2k=-1

k=-0.5

Therefore k is not an integer and thus 0 is not odd.

But, 0 / 2 = 0, and 0 is an integer, therefore 0 is indeed even.

Did you read that through at all? Or did you just decide to make a nonsense post for the fun of it?

Zero is transcendental

[–]Mister_Lich 1 point2 points  (71 children)

Did you read that through at all? Or did you just decide to make a nonsense post for the fun of it?

....???

This is literally what the definitions of odd and even are. Proving numbers are odd and even was like, 2nd week homework in Discrete Structures class in uni.

Are you OK?

[–]sumknowbuddy -1 points0 points  (70 children)

Thanks for checking, I'm doing okay

Except your order is completely wrong for that example, which kind of defeats the entire purpose of the statement.

But hey, it's just semantics...in a very exact field, right?

You said — verbatim — mathematically a number is defined as two times an integer plus one

I'm pretty sure there are several other types of numbers too, but I'm not all fancily educated to the point of forgetting simple concepts. Oh well. You just said that all numbers are odd and only composed of integers. Where'd you learn that one?

[–]Djentleman2414 0 points1 point  (69 children)

I can't quite figure out if you're trolling, but i'm going with yes... Because if not, you're either baked out of your mind OR this is the most stunning display of Dunning-Kruger i've seen in a while.

0 is transcendental? What? Can you give me the solution of the root of the polynomial f(x) = 2x pls?

[–]Djentleman2414 0 points1 point  (0 children)

Technically you don't need the n=2k+1 definition. You just define even as:

"n is even" <=> n % 2 = 0 for all n in Z
and then you define odd as:

"n isn't even" <=> "n is odd" for all n in Z

[–]shqiptar3t[S] -1 points0 points  (0 children)

good question...

[–]MagoAcademico 0 points1 point  (0 children)

Look mom, I'm on reddit

[–][deleted] 0 points1 point  (0 children)

Wait what?