# computer programmer's maths puzzle [closed]

A computer programmer looked at part of his code

x = x + 1;


and then thought what a strange equation that would be for a mathematician

$$x=x+1$$

The programmer asked some mathematicians if any number, $$x$$, would satisfy the mathematical version of the equation above.

Would it have been possible for one of the mathematicians to have suggested a number for $$x$$?

Note about edit I have tried to edit to give a well defined question - or at least better defined than the original question.

• Keep in mind that infinity is not a number
Sep 27, 2019 at 23:21
– tom
Sep 27, 2019 at 23:29
• Possible duplicate of What number + 1 equals itself? Sep 28, 2019 at 0:57
• Finally and most fatally, in my opinion, 3) how is this a puzzle? It seems more something to recognize than something to solve—that is, a trivia question more than a puzzle. Unless there is more to this than the answers to both questions have come remotely close to grasping, this isn’t a puzzle. (And if you just posed it to see if someone could find an answer that works, rather than posing it as a puzzle designed to hint toward a solvable answer, then I submit to you that you’ve posed that speculative question in the wrong site altogether.).
– Rubio
Sep 29, 2019 at 12:48
• @tom You ... may not be able to delete, as it's already drawn answers. For some general advice, see my answer to What should I do if I've made a mistake in my question?, which covers this ground pretty well. For this question in particular, I was actually going to respond that even a flawed question can serve as a good example of what kind of things do not work well, so if nothing else, I think that's a fair disposition for it. Note too that I'm more than tempted to make the related question a duplicate of this one, which I may yet do.
– Rubio
Sep 29, 2019 at 19:43

This seems to be a pretty open question to me. Some tries:

definition of a number

tell you about some of his thoughts about what qualifies as a number. If $$\pm$$ infinity qualifies as one, that would work for x.

Then of course there are

number spaces like $$\mod 1$$ in which e.g. $$0.5 \equiv 1.5 \mod 1$$

If you don't really have a

definition... I guess the mathematician would love to come up with something for you. For example just define that $$x$$ and $$1$$ should be "numbers", and $$+$$ means just ignoring all numbers after it. Then $$x = x + 1$$ would be true.

...but that's a pretty unusual thing to do. In real life I think I have already seen this:

$$1$$ meaning "everything" in set theory and $$+$$ meaning merging sets (being used instead of $$\cup$$). Then if $$x = 1$$ you merge two identical sets which results in the same set $$x$$. So $$x = x + 1$$ would be true here. But then sadly I guess sets don't quality as numbers? It fit so well that I wanted to include it though.

Oh, another one:

If you define $$=$$ as binding stronger than $$+$$ then technically, the equation $$x = x$$ is of course true for any number and the $$+1$$ can just be ignored

All of these approaches seem a bit cheet-y to me. I'd love to see a more elegant solution of this.

• thanks for the great answer. It would be accepted, but the question is not so good and I am likely to delete it.
– tom
Sep 29, 2019 at 16:30
• @tom That's ok. Would you mind telling what solution you personally had in mind before doing that? Sep 29, 2019 at 16:31
• sure no problem. For me the answer the computer scientist had in mind was infinity. I had not realized all the potential mathematical subtleties such as the answer in terms of set theory.
– tom
Sep 29, 2019 at 16:40

Well...

No such number exists that satisfies $$x=x+1$$. If $$x=\infty$$ then it is possible however $$\infty$$ is not a number.

• "Keep in mind that infinity is not a number – Adam 25 mins ago" - Why did you post then?
– Duck
Sep 27, 2019 at 23:48
• @Duck wording of - "Could anyone suggest a number for x?"
Sep 27, 2019 at 23:50
• "No such number exists that satisfies $x = x + 1$" Do you have a proof for that? Or is it just "obvious"? Sep 27, 2019 at 23:52

This is probably a bit too 'on the computer programming side' to be the mathematicians response, but still...

What about $$x=\frac{1}{9}$$? If $$+$$ is seen as the concatenation operation, then $$x=0.\overline{1}=0.\overline{1}+1$$.

• Welcome to puzzling SE - sorry that the question is not so good and I am likely to delete. I think your answer is quite ingenious and would upvote it, but as I am going to delete the question there is no point in upvoting I'm afraid. - Well done for using the format for hiding your answer! I hope that you enjoy Puzzling SE and consider answering other better questions.
– tom
Sep 29, 2019 at 16:33
• ok, see the comments by the question, but this question probably won't be deleted, so I upvote for the nice answer
– tom
Sep 29, 2019 at 20:18

When the computer sees the equals sign, it evaluates the expression to the right of the equal sign, then assigns the answer to that expression to the variable on the left side. It is not an equality but telling the computer to replace y with y+1. So y can be any number.

If this is wrong, please let me know, as I am not very good with programming and computer science.

• I think that's true but not the "mathematical version of the equation" but more of an programmer's view on it. Sep 27, 2019 at 23:50
• @palsch Well, x could be any number if my answer is correct.
– Duck
Sep 27, 2019 at 23:53
• I think the question aimed at not defining the $=$ like a programmer since a programmer asks a mathematician about his point of view, not the other way around. Sep 27, 2019 at 23:55
• Actually to be honest "Could anyone suggest a number for x?" is fairly ambiguous so this could be an answer