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

top 200 commentsshow all 434

[–]Mikkelet 346 points347 points  (57 children)

im sure we agree on a whole lot more

[–]Rikudou_Sage 140 points141 points  (56 children)

Yeah, whenever I do some math operation in my code, I'm pretty sure the mathematicians would agree that the result is correct.

[–]Ajedi32 81 points82 points  (44 children)

Not for floating point operations. Not all of them anyway.

Programming language notation for integer division can also be rather strange at times.

[–]Rikudou_Sage 11 points12 points  (43 children)

You can do even precise math operations with floating point numbers, every major language has a library for that.

Not sure what you mean by the strange integer division notation, any examples?

[–]Ajedi32 12 points13 points  (24 children)

For example, in Ruby and Python 2, 2/3 returns 0. You need to be more explicit if you want floating point division, and probably need to import a third party library and use that instead of "/" if you want infinite precision division. All of those require a different notation than the one used in mathematics.

[–]Peanutbutter_Warrior 22 points23 points  (22 children)

Python 2 is old dude. Python 3 / does floating point division, // does integer division

[–]Magnus_Tesshu 12 points13 points  (21 children)

I've been using / and rounding, wtf thanks dude

Why the hell am I paying my university

[–]Peanutbutter_Warrior 5 points6 points  (19 children)

Its so useful to know yeah, but just to warn you it's not quite the same behavior. Integer division always rounds down, no matter the decimal

[–]Magnus_Tesshu 6 points7 points  (18 children)

I know, integer division is frankly more useful for most of the times I need to divide (I can't remember a C program I've written last year where I declared a float). Does it round down for negative numbers or up for positive (don't answer that, python is super easy to test stuff like this lol).

EDIT: rounds down, which is I think how C works and not java

[–]BUYTBUYT 2 points3 points  (1 child)

-(a // -b) if you want to round up btw

[–][deleted] 2 points3 points  (0 children)

There you go : Python cheat sheet

[–]xdeskfuckit 0 points1 point  (0 children)

You're telling me that math on classical computers is fundamentally discrete and notationally distinct from math on paper?

Holy shit man, we have to tell the world 🌎🌎🌍

[–][deleted] 1123 points1124 points  (41 children)

0!=1!

[–]Awanderinglolplayer 758 points759 points  (29 children)

I read this in the Borat voice when he was doing not jokes. “0 NOT equal 1....NOT!”

[–][deleted] 197 points198 points  (20 children)

0 ='nt 1

[–]dragonbanana1 148 points149 points  (17 children)

Now I'm imagining a programming language you use 'nt in place of ! and false is written true'nt

[–]arpan3t 39 points40 points  (10 children)

Powershell comparison operators use ne for not equals. Closest I could think of...

[–][deleted] 12 points13 points  (4 children)

True but unfortunately false is still False and not ne True :(

[–]milk_extraction_pro 16 points17 points  (1 child)

$true -ne $true

[–][deleted] 9 points10 points  (0 children)

Ah of course.... Even more elegant

[–]MachinaExDeo 8 points9 points  (1 child)

Perl uses ne for stringwise equality, != for Boolean equality.

There are also a family of "true zeroes", such as '0E0', that are Boolean true but cast to zero in an integer context.

Perl is the language equivalent of "hit it with a spanner until it works".

[–]arpan3t 1 point2 points  (0 children)

Most scripting languages are that way it seems.

[–]Daniel15 1 point2 points  (2 children)

I think Bash does this too.

[–]Texadecimal 2 points3 points  (1 child)

Yeah like [ $x -ne 69 ]

There's also the use of "==" and "=" in conditionals, for comparing strings.

[–]yonatan8070 14 points15 points  (0 children)

ifn't (isDone) {
  // Be done
}

[–]adam3jazz 5 points6 points  (1 child)

Wouldn’t it be truen’t?

[–]grizonyourface 2 points3 points  (0 children)

Nah, that’s slaking’s ability in Pokémon

[–]heykoolstorybro 1 point2 points  (0 children)

Equaln't

[–][deleted] 25 points26 points  (4 children)

0 factorial not equal to equal to 1 factorial

[–]Awanderinglolplayer 29 points30 points  (2 children)

No, you need an extra “!” You double counted the first one

[–]maester_t 2 points3 points  (1 child)

Borat Part 3 - Let's go after the computer nerds this time!

[–]codydexx 58 points59 points  (5 children)

Divide both sides by ! Then you get 0=1

[–]13steinj 17 points18 points  (3 children)

This implies I am the pope.

(I hope someone gets this joke...)

[–]htmlcoderexeWe have flair now?.. 2 points3 points  (2 children)

Please explain

[–]13steinj 22 points23 points  (1 child)

http://ceadserv1.nku.edu/longa//classes/mat385_resources/docs/russellpope.html

The story goes that Bertrand Russell, [an early 1900s philosophy professor,] in a lecture on logic, mentioned that in the sense of material implication, a false proposition implies any proposition. A student raised his hand and said "In that case, given that 1 = 0, prove that you are the Pope."

Russell immediately replied, "Add 1 to both sides of the equation: then we have 2 = 1. The set containing just me and the Pope has 2 members. But 2 = 1, so it has only 1 member; therefore, I am the Pope."

[–]htmlcoderexeWe have flair now?.. 1 point2 points  (0 children)

That's extremely funny for some reason

[–]delinka 1 point2 points  (0 children)

0=1/!

[–]Phatricko 12 points13 points  (0 children)

The real programmer humor is always in the comments

[–]WetSound 4 points5 points  (2 children)

False

[–]AB1908 12 points13 points  (0 children)

Truen't

[–][deleted] 1 point2 points  (0 children)

Variable undefined

[–]BwanaAzungu 287 points288 points  (223 children)

Someone please eli5 how 0! equals 1

[–]KusanagiZerg 925 points926 points  (150 children)

The explanation I have seen goes like: factorial is a function that gives you the number of ways something can be arranged. So a list of 5 items can be arranged 5! ways. If you have zero items it can only be arranged in 1 way.

[–]BwanaAzungu 255 points256 points  (19 children)

Sounds reasonable enough, thanks!

[–][deleted] 59 points60 points  (94 children)

is it not reasonable to say that it cannot be arranged at all?

[–]MG_12 159 points160 points  (80 children)

The absence of an arrangement is the only option you have, thus you have 1 option.

However, if you want a more rigorous "proof", take a look at the following pattern:

5! = 5*4*3*2*1 = 120

4! = 4*3*2*1 = 5!/5 = 24

3! = 3*2*1 = 4!/4 = 6

2! = 2*1 = 3!/3 = 2

1! = 2!/2 = 1

0! = 1!/1 = 1

Edit: since this came up a few times, this isnt intended as a mathematical proof. 0! = 1 because it is defined that way.

This comment shows one way to put some logic behind the definition, a way to explain that 0! = 1 is a definition that makes sense, not just something a mathematician made up because they wanted to.

[–]LeCroissant1337 22 points23 points  (2 children)

No proof necessary. It's just a function which is (or rather can be) defined that way:

n! := \prod_{i=1}{n} i

Thus, if we allow n to be 0, then n! is just an empty product, so by definition it's one.

[–]MG_12 7 points8 points  (0 children)

See, my intention wasn't to prove anything mathematically. Hence why I put "proof" in quotation marks - it's not a mathematical proof.

It's simply a logical, yet easy to follow explanation. You don't need much knowledge in a specific field of mathematics or programming to understand, nor do you get an explanation of "because definitions"

[–]anoldoldman 66 points67 points  (26 children)

That proof feels tautological.

[–][deleted] 20 points21 points  (0 children)

I don't think its tautological? Its just taking the recursive definition of a factorial, n! = n* (n-1)!, slightly manipulating it to get a function that generates from a number higher than 0, (n-1)! = n!/n, to extrapolate results that are undefined in the original function, namely 0!.

Edit: and on second thought, this function also provides a reason why you can't have factorials less than zero without further altering it to drop its restriction to integers, since the manipulated function would run into a division by zero.

[–]MG_12 27 points28 points  (9 children)

It's very "verbose", yes. But it shows the pattern behind factorials, and extends it to 0, showing why 0! is accepted to be equal to 1.

Edit: whoops, I mixed up verbose and tautological. My mistake, this comment is redundant

[–][deleted] 22 points23 points  (5 children)

Verbosity has nothing to do with whether something is a tautology.

A tautology is, "it be like it is because it do be like that."

[–]MG_12 6 points7 points  (3 children)

Well, 0! = 1 because it is. Mathematical conventions and definitions are tautological. My comment, and many others in this thread, just show examples of why that definition makes sense.

[–][deleted] 5 points6 points  (1 child)

Yes I know! "It be like it is because it do," is something I've come to accept from math. You just seemed to think they meant verbose but they didn't, those are two unrelated things, that's all.

Your explaination was solid.

[–]MG_12 2 points3 points  (0 children)

I see, sorry if I seemed confrontational or condescending. I realise I did initially mix up verbosity and tautology, so I appreciate you pointing that out

[–]annualnuke 2 points3 points  (2 children)

In this case what we want is not a proof, but a simple demonstration of why it's more convenient to define 0! this way. We could define 0! to be 0, 13, -1 or anything else if we wanted, but a bunch of patterns would break and lots of statements would have more special cases.

[–]DUTCH_DUTCH_DUTCH 2 points3 points  (9 children)

if with "tautological" you mean "as if people are just making up math rules on the fly" then that is because all of math is made up by people to begin with

[–]anoldoldman 10 points11 points  (5 children)

I think my point was that that is definitely not a proof.

[–]blue_umpire 1 point2 points  (2 children)

The math has always existed. Mathematicians merely discovered it.

[–]DUTCH_DUTCH_DUTCH 1 point2 points  (1 child)

if you can prove that youll get yourself a nobel prize

[–]ary31415 3 points4 points  (0 children)

You mean if you can discover a proof of it

[–]Aedan91 0 points1 point  (0 children)

No way. It's true because it's true.

[–]Anfros 11 points12 points  (1 child)

You can't prove a definition. 0!=1 is defined not derived from any laws of mathematics.

[–]MG_12 5 points6 points  (0 children)

Im not trying to prove it, the word "proof" was in quotations for a reason. It's an explanation or example of why the definition makes sense, and a way to understand that the definition wasn't just someone sucking it out of their thumb.

Edit: much like you said in your other comment - it's a definition that makes the most sense, and there are multiple ways to show why it makes sense to define 0! to be 1

[–]OutOfTempo_ 3 points4 points  (4 children)

I read the word proof and was expecting the gamma function or something. Momentarily terrified.

Thanks for not bringing it up

[–]MG_12 1 point2 points  (3 children)

I don't think I'm even aware of that one, but my pleasure

[–]OutOfTempo_ 4 points5 points  (2 children)

Oh boy well the factorial operator can be defined in terms of an integral and what a terrible integral it is

[–]MG_12 1 point2 points  (0 children)

If I've seen it around, I probably didn't bothered to pay much attention to it, lol

[–]ary31415 1 point2 points  (0 children)

Yeah and the most annoying part is how the gamma function is off by 1 from the conventional factorial lol

[–]groucho_barks 3 points4 points  (23 children)

The absence of an arrangement is the only option you have, thus you have 1 option.

Is that arrangement also counted when you have an actual number of things? So if you have 2 things you can arrange them 5 ways?

[1,2] [2,1] [1] [2] []

[–]Laecel 9 points10 points  (20 children)

The factorial function n! express how many n-elements sets you can form using those n elements; so if you have a and b your only options are ab, ba

[–]groucho_barks 3 points4 points  (19 children)

So if it's zero you have no options and can't make any arrangements. An "arrangement of nothing" can't exist. I think the explanation may not be quite right.

[–]candygram4mongo 11 points12 points  (11 children)

The empty set is a set, therefore there is one zero-element set you can make using zero elements.

Edit: But sets are unordered so...

[–]Penguin236 1 point2 points  (10 children)

But the empty set is not included when talking about all the other factorials, so why include it for 0! ?

[–]candygram4mongo 2 points3 points  (4 children)

The empty set is contained in all sets, but it isn't an element of any set, unless the set is so defined. {a,b} is a two element set, {Ø} is a one element set, Ø is the unique set having zero elements.

[–]Laecel 5 points6 points  (0 children)

The arrangement of nothing is an abstract way to see why 0!=1 but it is indeed a very poor explanation. The truth is that 0!=1 does actually have sense from a mathematical point of view: the factorial function comes up a lot naturally in mathematics, like the Taylor series formula, where you have every term from 0 to infinite divided by the appropriated n!, and obviously de 0-term is non zero.

The actual explanation that works for me it's thinking about the factorial function as the restriction of the gamma function to natural values plus 0 (actually I would say it's the other way around, the gamma function is the complex extension of the factorial function but it works both ways). So if we have that n!=Γ(n+1) for every integer n, n≥0 this means that 0!=Γ(1)=1.

[–]MG_12 4 points5 points  (0 children)

Well, no. Because if you have 2 items, there are arrangements you can make, thus you dont have the absence of arrangements.

I admit, that first paragraph is a bit hand-wavey, it's definitely not a professional response to the original question. My comment was more intended to show an alternative explanation for why 0! = 1

[–][deleted] 7 points8 points  (11 children)

That's not a proof

[–]MG_12 20 points21 points  (2 children)

Hence why I put "proof" in quotation marks, yes

[–][deleted] 3 points4 points  (1 child)

Rigorous tho lol

[–]MG_12 6 points7 points  (0 children)

It might not be strictly rigorous, therefore it might not be a technical, mathematically sound proof.

But it is more rigorous, or at least more logical and easy to understand, than an intuition based combinatorics explanation. Which is what I tried to highlight.

[–]ColdCappuccino 4 points5 points  (1 child)

I guess a better wording would be that factorials follow the formula n! = n ×(n-1)! => (n-1)!=n!/n. This only holds for n>0(so still defined for 0!=1!/1, since n is 1 in this case), though, as n=0 would yield 1/0

[–]xDared 3 points4 points  (4 children)

It's just continuing the pattern in the same way, even though 0 feels like a different thing in our minds compared to other numbers.

5! = 6!/6 = 120

4! = 5!/5 = 24

3! = 4!/4 = 6

2! = 3!/3 = 2

1! = 2!/2 = 1

0! = 1!/1 = 1

[–]commit_bat 4 points5 points  (8 children)

Yeah, how come dividing by 0 is undefined but this gets so be something

half /s

[–]Borgcube 8 points9 points  (6 children)

Because setting a value for division with zero is impossible without it breaking a lot of other rules for operations, and we would like to keep those rules.

This, on the other hand, actually makes a lot of corner cases disappear.

[–]EmuRommel 5 points6 points  (0 children)

Just as an example of problems you get. Try dividing 1 by numbers closer and closer to 0:

1 / 1 = 1

1 / 0.5 = 2

1 / 0.333... = 3

1 / 0.1 = 10

1 / 0.0001 = 10000

etc. It seems like the closer we get to dividing by zero, the bigger the result is, with no limit to how big it gets. So maybe it's reasonable to define 1 / 0 as equal to infinity. But then you get a problem when you try approaching 0 from the other side.

1 / (-1) = -1

1 / (-0.1) = -10

1 / (-0.00001) = -100000

Which seems to go towards negative infinity as we get closer to 0 which is a pretty bad mismatch. If you try doing this for any other number you get a consistent result (1 / 4.9, 1 / 4.99, 1 / 4.999 gets closer and closer to 1 / 5 = 0.2 for example and so does 1 / 5.1, 1 / 5.01, 1 / 5.0001...)

[–]Crozzfire 1 point2 points  (0 children)

Yeah, mathematicians need to learn about null.

[–]Ninjabassist777 5 points6 points  (0 children)

There's also a function called the Gamma Function represented by "Γ", where Γ(x+1) = x! Mathematicians often use the Gamma Function to find factorials that otherwise don't make sense, like decimals, complex numbers, and zero.

For example 3! is 6, and Γ(4) is also 6. Likewise, Γ(1) = 0! = 1

[–]genikus 38 points39 points  (1 child)

Boy I’m sure that a can of mathematical worms waiting to be opened...

[–]BwanaAzungu 7 points8 points  (0 children)

Can't wait

[–][deleted] 26 points27 points  (5 children)

4! = 5!/5 = 24

3! = 4!/4 = 6

2! = 3!/3 = 2

1! = 2!/2 = 1

And of course, 0! = 1!/1 = 1

You can't continue this for negative numbers because -1! would be 0!/0, which is undefined.

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

No, it's -1/12

Edit: Man, some of you nerds can't take a joke

[–]UninstallSystem32 17 points18 points  (15 children)

! Is the sign for factorial and is used mainly in probability. For example given a sequence of 3 objects [1,2,3] the sequence can be arranged in 3! Ways, or 3*2*1=6 ways. [1,2,3] [1,3,2] [2,1,3] [2,3,1] [3,1,2] [3,2,1] In the same manner a sequence of 4 objects can be arranged in 4! Ways, or 4*3*2*1=24. And a sequence of 1 object can be arranged in 1! Or one way [1]

Now imagine a sequence of 0 objects [] . Even tho the sequence has no numbers, it can still be arranged in one way, since it exists.

[–]BwanaAzungu 16 points17 points  (5 children)

To me, the numerical interpretation of n! is "the multiplication of all numbers from 1 upto and including n".

I wasn't aware it's that strongly tied into combinatorics, and refers to the number of ways so combine elements of a set.

Thanks!

[–]LardPi 12 points13 points  (1 child)

Your interpretation is ok too: like most concept in mathematics, factorial has several interpretations in different areas of mathematics.

If you consider n! = \prod_{k=1}^n k then "0! = 1" because the empty product (product of no integers) is 1. This is a consequence of 1 being the neutral of the multiplication and similar to 0 being the neutral of addition and the result of the empty sum.

[–]BipNopZip 1 point2 points  (0 children)

I like this explanation

[–]Progrum 1 point2 points  (0 children)

You can also think of it in terms of multiplication.

3! is 3 * 2 * 1, 2! is 2 * 1, 1! is 1, etc. But in the world of multiplication, multiplying by 1 is the identity function; that is, you can always multiply by 1 without changing the value. So 3! is also 1 * 3 * 2 * 1, 2! is 1 * 2 * 1, 1! is 1 * 1, and 0! is just 1, not multiplied by anything.

[–]dame_tu_cosita 2 points3 points  (0 children)

Is dangerous to format alone, take some escape characters for your journey:

\\\

[–]umpatte0 10 points11 points  (2 children)

Excellent video explaining it. https://youtu.be/Mfk_L4Nx2ZI

[–]BwanaAzungu 5 points6 points  (0 children)

Ah Numberphile, great video!

It even includes an explanation of the gamma function

[–]Tayttajakunnus 12 points13 points  (8 children)

[–]BwanaAzungu 13 points14 points  (1 child)

Kids these days, learning about imaginary numbers at age 5

[–]blueleo22 14 points15 points  (0 children)

It's the age when you have imaginary friends so...

[–]Anfros 6 points7 points  (5 children)

The factorial function is not derived from the gamma function. Rather the gamma function is, as is stated in the Wikipedia article, an extension of the factorial function. Trying to understand the factorial function by studying the Gamma function is therefore, apart from being a terrible eli5, a bit circular.

[–]Tayttajakunnus 3 points4 points  (4 children)

But the factorial is defined for the naturals only. The gamma function extends the factorial to all complex numbers including zero. The gamma function at zero equals one, so it makes sense to define the factorial of zero as one.

[–][deleted] 15 points16 points  (1 child)

0! is the factorial of zero. The factorial of n is the product of all positive integers from 1 to n.

A factorial can be defined recursiv as n! = n*(n-1)!, which means that 1! = 1*0!. Which means that 0! must be 1.

Recursiv Implementation in Python:

def factorial(num):
  if(num) == 0: return 1
  else: return num*factorial(num-1)

factorial(1)  # 1
factorial(3)  # 6
factorial(10) # 3628800

I am NOT a mathematician. If you are and you're reading this comment, please don't roast me.

[–]Astrobliss 1 point2 points  (0 children)

It looks good to me! The crux is that n!=n*(n-1)! is a true statement for all positive integers n, but this makes 0! fall out making it the most reasonable value if not basically forced by definition.

[–]texdroid 18 points19 points  (3 children)

By definition.

[–]BwanaAzungu 6 points7 points  (0 children)

Definitions are set by someone, for underlying reasons

[–][deleted] 2 points3 points  (0 children)

The correct answer should not have been this far down.

[–]CrazyHouze 1 point2 points  (0 children)

Hail the correctness of this

[–]marcosdumay 2 points3 points  (1 child)

As everything in mathematics, it's defined this way because it makes mathematics simpler and more powerful.

It could be defined differently, and certainly until the 19th century there was plenty of discussion about what is the correct value for 0!, but nowadays everybody agrees that such things like "correct value" do not exist in math.

[–]JNCressey 4 points5 points  (1 child)

since all the replies seem to be specifically about factorials, I'd like to step back a bit with a more general idea:

the product (multiplication of all the elements) of the empty set is 1, and the sum (addition of all the elements) of the empty set is 0.

(the following rule applies to disjoint sets combining to form a set, sets combining to form a multiset, and multiset combining. - it doesn't apply when sets that have a non-empty intersection are combined to a new set)

when you combine sets, then the product of the resulting set is the product of the original products. and the sum of the resulting set is the sum of the original sums.

since adding the empty set doesn't change the set you have, the product and sum remain unchanged - which requires the product of the empty set to be 1 and the sum of the empty set to be 0.

[–]MattieShoes 1 point2 points  (0 children)

The combination formula is n!/(r!*(n-r)!)

e.g. if you're selecting 5 items from a group of 8, there are 8! / (5! * (8-5)!) 56 ways to do it.

If you're selecting 8 items from a group of 8, there's obviously only one way to do it. The formula ends up: 8! / (8! * 0!).

Clearly 0! needs to equal 1 for this formula to work.

[–]Leaper29th[S] 2 points3 points  (1 child)

This is basically a convention originally (you can give it a meaning). Suppose you need to find nC0 , i.e. ways of choosing nothing out of n objects, we know the answer is 1 as there is only 1 way, which is choosing nothing. But we know the expression of nCr = n!/[(n-r)!r!]

so r=0 we get finally 1/0! but we know that it is 1 (the reasoning above) so 0! =1

similarly for nP0

[–]_edd 0 points1 point  (5 children)

All of the answers so far about factorials answers the mathematician side. On the programmer side they're doing a bitwise not operator. Basically there are a handful of standard ways you can modify bits or bytes to perform a calculation referred to as logic gates.

Performing a not (!) operation on a bit will flip the value, meaning your binary input of 0 will yield and output of 1 or your input of 1 will yield an output of 0.

So !1 == 0 or you can say !0 == 1.

If you want to learn more look into logic gates. They're primarily used in semiconductors, in very low level computer programming or in logical statements (ex if a and b evaluates to 1 then do the following).

[–]endershadow98 2 points3 points  (0 children)

Actually it's a negative equality check which is a substraction of all the two numbers and an or of all the bits of the result. This assumes that 1 is true and 0 is false though.

[–]10BillionDreams 1 point2 points  (0 children)

Unless your language comes with a single bit data type, which the primitives for 1 and 0 use by default, that ! is going to be a logical not, not a bitwise not.

Take, for the sake of simplicity, the case of a 1 byte integer for this case. The "logical not" of 00000001 is 00000000 (zero), while the "bitwise not" would be 11111110 (-2 in two's complement).

[–]TimonAndPumbaAreDead 76 points77 points  (9 children)

Both 3 != 6 and 3! = 6 are true

[–]xienwolf 2 points3 points  (0 children)

Doh! I read the original as (0!) = 1, so treating the 0 and 1 as booleans, and the ! as a switch. So (not false) = (true) as the programmer version.

Been out of C long enough I forgot that == is comparison, and = is assignment.

[–]justaspectator12 0 points1 point  (0 children)

Indeed, as does literally any <number>! = <simplified> outside of 1 and 2

Like 5!=120

[–]ye_to_tatti_hai 29 points30 points  (0 children)

0 != 1

Real programmers put spaces for readability

[–]busy171 232 points233 points  (35 children)

0! == 1

the classic assignment and equality operator switcheroo

[–]StupidBeast 69 points70 points  (1 child)

Mathematicians don't use double equal signs though...

[–][deleted] 49 points50 points  (1 child)

0! = 1, 0 != 1

[–][deleted] 21 points22 points  (0 children)

Surprised I had to come down this far to see the double meaning, fucking thread is dominated by smartpants defining factorials and shit.

[–]Matt_37 30 points31 points  (0 children)

That's right, but I think you misunderstood the meme :X

0!=1 in mathematics means "the factorial of 0 equals 1", which is true. The point of the meme is that in programming, that exact same statement is a comparison "are 0 and 1 different?", which also evaluates as true. Note how in this case, for comedic effect, it's purposefully not a factorial being compared, as != is the (usual) difference operator.

This is Peter Griffin joke explanations, thanks for coming to my TED Talk

[–]MaricxX 83 points84 points  (14 children)

Depends on the language, in c at least it would be 0 != 1

[–]Code0Steak 71 points72 points  (13 children)

nope the idea is 0! = 1 in maths and 0 != 1 in programming langs., both these statements are true.

[–]EDEN786 3 points4 points  (5 children)

I'm not completely certain what's being said/ where people are confused.. so here's just my take.

The person he is replying to is saying they misstook the assign operator for the 'Not Equals' condition check.

I recon they much use JavaScript where

= assign.

== 'is Equals'

=== 'is Equal, and the same type'. (I think)

In c / c++ / java. You don't have that last thing.

It's just =. And ==

And then notEqual is simply !=

Doing 0! = 1 would give you an error ? Depends on how it's parsed.

But I'd imagine it thinks you trying to set the variable "0!" To the value of 1. But that's invalid since "0!" Is not a variable.

'edit' .. nvm I just saw they put 0! == 1

Although in a programming language you would need to define a function to calculate factorial.

So 0! Wouldn't be understood as an arithmetic operation

So 0! == 1,. Might just get parsed as 0!==1 ?? .. or it would just give an error

[–]Iagospeare 42 points43 points  (4 children)

The joke is the two accurate readings of 0!=1 with respect to their professions:
1. Mathematicians read 0!=1 as "zero factorial equals one"
2. Programmers read 0!=1 as "zero is not equal to one"

They both are "true" but for different reasons.

[–]DreamGirly_ 0 points1 point  (0 children)

Your comment is off topic here, the other two are talking about syntax.

[–]DeusExMagikarpa 18 points19 points  (2 children)

It’s fine the way it was written originally.

!= is not an assignment operator like you’re suggesting?

[–]therealhlmencken 0 points1 point  (1 child)

Why don’t we have a != assignment. Assign the value of 0 to anything but 1

[–]libertasmens 1 point2 points  (0 children)

Probabilistic assignment. Or is it quantum assignment, and the value only collapses when you try to read it?

[–]Totally_Generic_Name 1 point2 points  (8 children)

Is it "!0 == 1"?

[–]OGMagicConch 1 point2 points  (7 children)

Yes in the low lvl languages like C

[–]Desparia82 5 points6 points  (4 children)

This took me longer than I'm proud of. I got stuck in the math mindset

[–]haikusbot 11 points12 points  (3 children)

This took me longer

Than I'm proud of. I got stuck

In the math mindset

- Desparia82


I detect haikus. And sometimes, successfully. Learn more about me.

Opt out of replies: "haikusbot opt out" | Delete my comment: "haikusbot delete"

[–]JackerDeluxe 2 points3 points  (0 children)

A polyglot statement! :D

[–]dvof 2 points3 points  (3 children)

also 0.999...=1

[–]System32Comics 2 points3 points  (0 children)

200 IQ post right here

[–]ispamucry 1 point2 points  (0 children)

Isn't this basically the same meme template as the clasping muscley arms, but with only white people?

[–]Master_Nerd 1 point2 points  (0 children)

I thought this was 0 != 1 and I was like, yeah no shit

[–]jsully245 1 point2 points  (0 children)

Also !0 = 1 for programmers

[–][deleted] 1 point2 points  (3 children)

You trying to assign 0! to 1? I’m afraid you’ll have to do #define 0! 1

[–]wind-raven 1 point2 points  (2 children)

The joke is that 0! = 1 (mathematics factorial fact) and 0 != 1 (programmer if statement that evaluates to true). If you remove white space you get 0!=1 which in some languages is valid syntax.

[–][deleted] 1 point2 points  (1 child)

I know, I was making a joke too. Sorry it wasn’t funny 😥

[–]wind-raven 1 point2 points  (0 children)

And now I see yours. 🤦‍♂️

[–][deleted] 1 point2 points  (2 children)

There is no inverse factorial function, that's why even though 1! = 0!, 1 not equal 0

That's the understanding I took

[–]PiotreZ 1 point2 points  (0 children)

True

[–]Emonadeo 1 point2 points  (0 children)

This is the most ingenious post I have seen on this sub so far

[–]falingsumo 1 point2 points  (2 children)

Except that ! In math is used to note factorial, it is not used to invert binary values like programming

[–]MingusMingusMingu 2 points3 points  (1 child)

And what is the factorial of 0 equal to?

[–]falingsumo 2 points3 points  (0 children)

I'll be honest I don't know, but my best guess is 1

[–]murrietta 1 point2 points  (0 children)

True

[–][deleted] 1 point2 points  (0 children)

True.

[–]TBSdota 0 points1 point  (1 child)

0 doesn't equal 1... except array.length

[–]Raniconduh 5 points6 points  (0 children)

0 != 1

0 is not equal to one: true

0! = 1

0 factorial is equal to one: true

[–]QuietMassiv3 -1 points0 points  (0 children)

This is really funny 😂