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


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.

  • 1
    $\begingroup$ Keep in mind that infinity is not a number $\endgroup$ – Adam Sep 27 '19 at 23:21
  • $\begingroup$ @adam maybe that should be an answer.... $\endgroup$ – tom Sep 27 '19 at 23:29
  • 6
    $\begingroup$ Possible duplicate of What number + 1 equals itself? $\endgroup$ – Belhenix Sep 28 '19 at 0:57
  • 1
    $\begingroup$ 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.). $\endgroup$ – Rubio Sep 29 '19 at 12:48
  • 1
    $\begingroup$ @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. $\endgroup$ – Rubio Sep 29 '19 at 19:43

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

First, he asks you about your

definition of a number

Whatever you answer, he may

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.

| improve this answer | |
  • $\begingroup$ thanks for the great answer. It would be accepted, but the question is not so good and I am likely to delete it. $\endgroup$ – tom Sep 29 '19 at 16:30
  • $\begingroup$ @tom That's ok. Would you mind telling what solution you personally had in mind before doing that? $\endgroup$ – palsch Sep 29 '19 at 16:31
  • $\begingroup$ 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. $\endgroup$ – tom Sep 29 '19 at 16:40


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

| improve this answer | |
  • 1
    $\begingroup$ "Keep in mind that infinity is not a number – Adam 25 mins ago" - Why did you post then? $\endgroup$ – Duck Sep 27 '19 at 23:48
  • $\begingroup$ @Duck wording of - "Could anyone suggest a number for x?" $\endgroup$ – Adam Sep 27 '19 at 23:50
  • $\begingroup$ "No such number exists that satisfies $x = x + 1$" Do you have a proof for that? Or is it just "obvious"? $\endgroup$ – palsch Sep 27 '19 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$.

| improve this answer | |
  • $\begingroup$ 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. $\endgroup$ – tom Sep 29 '19 at 16:33
  • $\begingroup$ ok, see the comments by the question, but this question probably won't be deleted, so I upvote for the nice answer $\endgroup$ – tom Sep 29 '19 at 20:18

The answer is (I think):

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.

| improve this answer | |
  • $\begingroup$ I think that's true but not the "mathematical version of the equation" but more of an programmer's view on it. $\endgroup$ – palsch Sep 27 '19 at 23:50
  • $\begingroup$ @palsch Well, x could be any number if my answer is correct. $\endgroup$ – Duck Sep 27 '19 at 23:53
  • 2
    $\begingroup$ 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. $\endgroup$ – palsch Sep 27 '19 at 23:55
  • $\begingroup$ Actually to be honest "Could anyone suggest a number for x?" is fairly ambiguous so this could be an answer $\endgroup$ – Adam Sep 27 '19 at 23:56
  • $\begingroup$ What is the downvote for? I will delete my answer if you want... $\endgroup$ – Duck Sep 28 '19 at 0:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.