35
4
Goal:
Given two natural numbers (integers from 0 to infinity), output a number that is not the sum of those numbers, but is a natural number.
Example solutions (TI-Basic):
A+B+1
not(A+B)
Invalid solutions:
A+B-1
(for inputs0,0
, it returns-1
, which is not natural)"ABC"
(ABC
is not a number)
Notes:
The output must always be a sum of two natural numbers (which is actually just a natural number)
-1
,undefined
,infinity
,NaN
and Error messages are not natural numbers. For our purposes,0
is natural (although not all mathematicians agree).
1Maybe we take the numbers as strings and output as a string? – xnor – 2017-02-13T03:01:52.907
1Can the output have leading zeroes? – user41805 – 2017-02-13T08:27:47.027
@Kritixi_Lithos Yes (allowed by default) – Julian Lachniet – 2017-02-13T11:38:21.220
1I presume overflows need to be taken into account, so the result of 2^32 -1 and 2 should not be negative, right? – adrianmp – 2017-02-13T12:28:07.890
@adrianmp Overflows are not necessary – Julian Lachniet – 2017-02-13T15:06:26.437
2Just a small remark because I like to pay attention to useless details: 0 is not a natural number. If you change the first sentence to "Given two non-negative integers ...", there won't be any useless detail left for me to comment on. :) – peech – 2017-02-13T17:11:00.917
6@peech This is not true. 0 is considered a natural number under some definitions. You cannot see it because it has been deleted but there has been an extensive conversation on this matter. – Post Rock Garf Hunter – 2017-02-13T17:16:32.137
1@WheatWizard My apologies. I didn't know about that conversation. – peech – 2017-02-13T17:20:14.630
To have none of something is quite natural. Think of it that way. Anyways, if you look at the Wikipedia article, it seems that even though some people still exclude zero, the standards are moving towards including zero. (Programmers start counting at zero, the standard ISO 80000-2 includes zero, set theory uses zero as the empty set, etc). ℕ = {0,1, 2, …}; ℤ+= {1, 2, …}
– mbomb007 – 2017-02-16T17:53:56.060"Die ganzen Zahlen hat der liebe Gott gemacht, alles andere ist Menschenwerk" ("God made the integers, all else is the work of man."). -Leopold Kronecker . – Kelly Lowder – 2017-02-17T15:26:07.930