# 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 inputs 0,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).

• Maybe we take the numbers as strings and output as a string? – xnor Feb 13 '17 at 3:01
• Can the output have leading zeroes? – user41805 Feb 13 '17 at 8:27
• I presume overflows need to be taken into account, so the result of 2^32 -1 and 2 should not be negative, right? – adrianmp Feb 13 '17 at 12:28
• Just 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 Feb 13 '17 at 17:11
• @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. – Ad Hoc Garf Hunter Feb 13 '17 at 17:16

# Java - 44 bytes

int n(int a,int b){return Math.abs(a+(-b));}


Returns an absolute value of a + (-b)

Ungolfed version:

int n(int a, int b) {
return Math.abs(a + (-b));
}

• Wouldn't it fail for 0 and 0? – MatthewRock Mar 1 '17 at 23:19
• @MatthewRock didnt check that. I willfix it tomorrow – cookie Mar 1 '17 at 23:23
• Isn't a+(-b) equivalent to a-b? – Zacharý Sep 16 '17 at 13:41

# ForceLang, 33 bytes

def a io.readnum()
io.write a+a+1

• Does this take two numbers as input? – Blue Feb 26 '17 at 12:55
• @muddyfish Yes. – SuperJedi224 Feb 26 '17 at 12:59

# Cardinal, 7 bytes

%:+~:*.


Outputs sum + 1

Try it online!

# Melang (Non competing) 13 bytes

\n\n+\n+\n\ni


I wrote Melang for this challenge and decided that it works so might as well bring it here.

Adds the numbers inputted together and adds one. For more on the language and to try it out visit here.

• Wait, those aren't literal newlines? – ASCII-only Apr 10 '17 at 9:30
• @ascii nope! Literal newlines error my implementation due to the website restrictions – Christopher Apr 11 '17 at 1:33
• How does it error in your implementation? – ASCII-only Apr 11 '17 at 1:35
• @ascii the way string inputs are taken in the website I used to write it breaks it – Christopher Apr 11 '17 at 1:40
• well that's a JS implementation limitation not a melang implementation limitation, you do know you can make it a Stack Snippet and it would work right? – ASCII-only Apr 11 '17 at 1:41

(succ.).(+)


EDIT: Of course, if you want to go with the boring answer:

a#b=a+b+1


is 9 bytes.

• Non pointfree a#b=1+a+b is two bytes shorter. – Laikoni Apr 1 '17 at 9:21

# c++, 28 bytes

[](int a,int b){return!a+b;}


Try it here

# Japt, 3 bytes

NxÄ


Try it online

## Explanation

N   :The array of all inputs
x   :Sum the array
Ä   :Add one to each element


# Aceto, 9 bytes

ir+1
ri+p


Super straightforward. Prints the sum of the two inputs and 1. If I can assume for the inputs to be on the stack already, there's a 5-byte solution:

1+
+p


## MarioLANG, 35 bytes

;
)
;
>[!(+:
"=#===
) -
+ (
! <
#="


Reads two inputs and puts them in differents cells (variables). Increments one and decrements the other until the second number is zero. Then adds one calculate the wrong answer.

((::)~*)~(~)~*a*^*(**)*


Takes input in the form of Church numerals on the stack and outputs to the stack.

Try it online!

# Excel VBA, 13 Bytes

Anonymous VBE immediate window function that takes input from range [A1:B1] (... or really any range that is a subset of [1:1], I suppose) and outputs their sum +7

?[Sum(1:1)+7]


# Braingolf, 3 bytes [non-competing]

g1+


Appends the inputs to eachother (ie 17, 4 becomes 174), then increments by 1.

Notable testcases:

[0, 0] becomes 00, becomes 01
[0, 1] becomes 01, becomes 02
[1, 0] becomes 10, becomes 11
[1, 1] becomes 11, becomes 12

• 00 is equivalent to 0+0 = 0 as noted in the comments for Windows Batch (among others) – Ephphatha May 28 '17 at 4:01

# Windows batch, 24 23 17 bytes

@cmd/cset/a%1+%21


# Test cases:

Tested on Win10 64-bit

Foo\Bar\Baz>NotCalc.bat 1 55
552


Note: batch files are limited to 32-bit signed integer!

• isn't 0+0 with a trailing 0 00, which is 0? – undergroundmonorail Mar 31 '17 at 20:58
• Oh yeah. I forgot that – stevefestl Apr 1 '17 at 1:36
• I tested it for you (also on Win7 64-bit). 1+55 returns 552. I don't understand the program well enough to explain why it returned that and not 561, but I tried some other inputs and got more weird results like 5+9=96. I'm not sure why that is, but my limited testing didn't find anything that outputs a correct sum... – undergroundmonorail Apr 1 '17 at 4:03
• It adds a trailing one to 55 so it becomes 551, 1+551=552 and 9 became 91, 5+91=96 – stevefestl Apr 1 '17 at 5:18
• Oh, I see. I thought it was adding a 1 to the result. – undergroundmonorail Apr 1 '17 at 5:21

# Perl 5, 8 bytes

7 bytes of code + 1 flag (-p)

\$_+=!<>


Try it online!

• Pretty sure perl gets -p free. – MD XF Nov 16 '17 at 3:32

# Aceto, 6 bytes

rrJiIp

r reads input and puts on stack (x2)
J concatenates top 2 values
i makes it an integer
I increments it
p prints it

Try it online!

# Implicit, 2 bytes

+.


Try it online!

+.   implicit input of two integers
.   and increment


= also works for 1 byte, but I added that to the existing list of =s.

# x86 opcode, 2 bytes

INC EDX
RET


input EAX and EDX, output EDX:EAX If D':A=D+A then D has to be zero, making the equation still not correct

# x86 opcode __cdecl, 3 Bytes

MOV DL, 3
RET


# GolfScript, 3 bytes

Input is to be taken as two separate lines. In GolfScript, a preceding 0 is allowed for numbers.

n/0


Try it online!

## Explanation

# Two inputs taken with newlines
n/  # Split the input (separated by newlines) with newlines
0 # Add a 0 to prevent a preceding 0
# Implicit concatenation


# GolfScript, 3 bytes

~+)


Try it online!

# Explanation

~   # Evaluate the input
+  # Add the two numbers
) # Increment the sum