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+1not(A+B)
Invalid solutions:
A+B-1(for inputs0,0, it returns-1, which is not natural)"ABC"(ABCis 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,NaNand Error messages are not natural numbers. For our purposes,0is natural (although not all mathematicians agree).
-
1\$\begingroup\$ Maybe we take the numbers as strings and output as a string? \$\endgroup\$xnor– xnor2017年02月13日 03:01:52 +00:00Commented Feb 13, 2017 at 3:01
-
1\$\begingroup\$ Can the output have leading zeroes? \$\endgroup\$user41805– user418052017年02月13日 08:27:47 +00:00Commented Feb 13, 2017 at 8:27
-
1\$\begingroup\$ I presume overflows need to be taken into account, so the result of 2^32 -1 and 2 should not be negative, right? \$\endgroup\$adrianmp– adrianmp2017年02月13日 12:28:07 +00:00Commented Feb 13, 2017 at 12:28
-
3\$\begingroup\$ 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. :) \$\endgroup\$peech– peech2017年02月13日 17:11:00 +00:00Commented Feb 13, 2017 at 17:11
-
9\$\begingroup\$ @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. \$\endgroup\$Wheat Wizard– Wheat Wizard ♦2017年02月13日 17:16:32 +00:00Commented Feb 13, 2017 at 17:16
94 Answers 94
RProgN, (削除) 4 (削除ここまで) (削除) 3 (削除ここまで) 1 Byte
E
The most simple of solutions, compares if A and B are equal. Pushes true, which RProgN sees as 1, if they are the same, or false aka 0 otherwise.
Test Cases
0+0 = 1
1+たす0 =わ 0
0+たす1 =わ 0
1+たす1 =わ 1
-
28\$\begingroup\$ I just went down the rabbit hole with your crossed out link. I rate it <s>4</s>/4 \$\endgroup\$Rohan Jhunjhunwala– Rohan Jhunjhunwala2017年02月14日 01:10:15 +00:00Commented Feb 14, 2017 at 1:10
-
2\$\begingroup\$ @RohanJhunjhunwala hold my 4, I'm going in \$\endgroup\$Albert Renshaw– Albert Renshaw2017年02月14日 03:20:41 +00:00Commented Feb 14, 2017 at 3:20
-
4\$\begingroup\$ ̶4̶ <-- u+0336 (combining character) may be a better way to do it \$\endgroup\$Albert Renshaw– Albert Renshaw2017年02月14日 03:23:05 +00:00Commented Feb 14, 2017 at 3:23
-
3\$\begingroup\$ PSA: codegolf.stackexchange.com/questions/48100/… Original crossed out thing \$\endgroup\$user63187– user631872017年02月27日 23:50:39 +00:00Commented Feb 27, 2017 at 23:50
-
4\$\begingroup\$ @AlbertRenshaw the old PPCG crossed-out-4-a-roo? \$\endgroup\$Riker– Riker2017年03月07日 16:36:48 +00:00Commented Mar 7, 2017 at 16:36
Python, 13 bytes
[(0,0)].count
Try it online! Takes input as a tuple.
Using an object method for the function avoids the boilerplate of a lambda.
lambda a,b:a-~b # 15 bytes
Here, the idea is to map (0,0) to 1 and everything else to 0. Since only 0+0 gives a sum of 0 among natural numbers, that always avoids matching the sum.
If one could output a Boolean here, which I find shady, a byte could be saved as
(0,0).__ge__
This checks if the input tuple is at most (0,0), which is only true for (0,0). In Python, True==1 and False==0. Even more shadily, outputting via exit code and treating that as a Python Boolen would save two bytes:
[(0,0)].pop
If string I/O is allowed and leading zeroes are OK, there's the 8-byte solution
'1'.join
This concatenates a1b, which is always bigger than a+b.
-
2\$\begingroup\$
int.__eq__for 10 bytes \$\endgroup\$Blue– Blue2017年02月13日 12:48:31 +00:00Commented Feb 13, 2017 at 12:48 -
1\$\begingroup\$ @muddyfish Yeah, I saw suever's answer too, didn't think of using equality. It returns a bool though, which I think is iffy on a challenge that asks for a number output. \$\endgroup\$xnor– xnor2017年02月13日 13:32:46 +00:00Commented Feb 13, 2017 at 13:32
-
3\$\begingroup\$ IMO if it swims like a number and quacks like a number, it's reasonable to assume it's a number. \$\endgroup\$CalculatorFeline– CalculatorFeline2017年06月19日 17:47:38 +00:00Commented Jun 19, 2017 at 17:47
Retina, 3 bytes
1
(The first line has a space before the newline. Stack Exchange isn't very good at showing trailing whitespace.)
Input is the numbers in decimal, separated by a space (e.g. 12 34). This program just changes the space to a 1, creating a number too large to be the sum of the input numbers (it necessarily has at least 2 more digits than either, and adding two numbers produces an output with no more than 1 digit more than the larger input).
-
2\$\begingroup\$
0 0should also work. \$\endgroup\$Dennis– Dennis2017年02月13日 03:59:09 +00:00Commented Feb 13, 2017 at 3:59 -
1\$\begingroup\$ @Dennis: I was wondering about that.
010is considered to be an integer via basically all integer parsers. I can see a potential argument that0 8is invalid on the basis that018is considered invalid octal via some integer parsers (although it's considered to be decimal 18 by others). Note that this program is quite happy to handle leading zeroes in the input, treating them as decimal; and I've written programs that output leading zeroes for other questions without people seeing a problem. Is there a relevant meta post on the subject? \$\endgroup\$user62131– user621312017年02月13日 04:04:19 +00:00Commented Feb 13, 2017 at 4:04 -
2\$\begingroup\$ Or
.1if you don't want to return leading zeros yourself. \$\endgroup\$Martin Ender– Martin Ender2017年02月13日 14:48:08 +00:00Commented Feb 13, 2017 at 14:48 -
\$\begingroup\$ @MartinEnder > but is a natural number \$\endgroup\$wizzwizz4– wizzwizz42017年02月14日 19:43:53 +00:00Commented Feb 14, 2017 at 19:43
-
\$\begingroup\$ @wizzwizz4 I'm not following. \$\endgroup\$Martin Ender– Martin Ender2017年02月14日 19:44:43 +00:00Commented Feb 14, 2017 at 19:44
MATL, et al. 1 byte
=
Accepts two natural numbers as inputs and compares them. If they are equal, the output is 1 and if they not equal the output is 0. This is the same approach as @ATaco's solution.
-
3\$\begingroup\$ The
=solution also works in Jelly for 1 byte. I thought I'd mention it in the comments as it doesn't seem worth creating a separate answer for the trivial solution. \$\endgroup\$user62131– user621312017年02月13日 03:01:53 +00:00Commented Feb 13, 2017 at 3:01 -
\$\begingroup\$ @ais523 Updated to include that. Thanks. \$\endgroup\$Suever– Suever2017年02月13日 03:07:37 +00:00Commented Feb 13, 2017 at 3:07
-
2\$\begingroup\$ Also in Stacked. Try it online! \$\endgroup\$Conor O'Brien– Conor O'Brien2017年02月13日 16:36:17 +00:00Commented Feb 13, 2017 at 16:36
-
\$\begingroup\$ Can you add APL and J? \$\endgroup\$Adám– Adám2017年02月14日 18:08:03 +00:00Commented Feb 14, 2017 at 18:08
-
\$\begingroup\$ @Adám Sure thing. Do you have a TIO link that I can link to? \$\endgroup\$Suever– Suever2017年02月14日 18:19:45 +00:00Commented Feb 14, 2017 at 18:19
Javascript, 10 bytes
x=>y=>!x+y
Takes 2 numbers using currying syntax like so:
(x=>y=>!x+y)(0)(0) // 1
-
4\$\begingroup\$ Welcome to the site! :) \$\endgroup\$DJMcMayhem– DJMcMayhem2017年02月13日 22:04:32 +00:00Commented Feb 13, 2017 at 22:04
-
\$\begingroup\$ Thanks =) I've been reading challenges for a while, just trying to find a good place to start. \$\endgroup\$Malivil– Malivil2017年02月14日 13:52:01 +00:00Commented Feb 14, 2017 at 13:52
Brain-Flak, 8 bytes
({}{}())
This is the most readable brain-flak answer I have ever written. :)
Explanation:
( ) # Push the sum of all the following:
{} # The first input
{} # The second input
() # and one
Alternate solutions (also 8 bytes):
({}[]{}) # Sum + 1
([]{}{}) # Sum + 2
There's a bunch of other solutions that only work with positive numbers:
(<{}>{})
({}<{}>)
({{}}())
({{}()})
({{}}[])
({{}[]})
Vim, 3 bytes/keystrokes
<C-a>gJ
Note that <C-a> is actually ctrl-a, which represents byte 0x01.
I love it when vim (which isn't even a programming language) can compete with golfing languages. :) Input comes in this format:
a
b
This simply increments the first number by one (This is the <C-a> part) and then joins the string representations of the two numbers together. As far as I can tell, this should never result in the sum.
TI-Basic, 3 bytes
not(max(Ans
Alternative solutions:
10^(sum(Ans 3 bytes @DestructibleWatermelon
not(sum(Ans 3 bytes
1+sum(Ans 4 bytes
Input :X=Y 5 bytes @ATaco
Input :X+not(Y 6 bytes
Input :not(X+Y 6 bytes
Input :10^(X+Y 6 bytes
Input :X+Y+1 7 bytes
Input :not(max(X,Y 7 bytes
Ans(1)=Ans(2 8 bytes
Ans(1)+not(Ans(2 9 bytes
not(Ans(1)+Ans(2 9 bytes
It's interesting that you made the question's examples in TI-Basic, but you forgot the shorter A=B (or maybe it was up to us to find out?)
-
1\$\begingroup\$ Nobody likes it when the OP posts a super short solution in the question, making it hard to beat. \$\endgroup\$mbomb007– mbomb0072017年02月13日 20:20:35 +00:00Commented Feb 13, 2017 at 20:20
-
\$\begingroup\$ @mbomb007 I suppose, but those were only snippets and not full programs. Adding
Prompt A,B:to them brings the byte count to eight bytes each. \$\endgroup\$Timtech– Timtech2017年02月13日 22:14:51 +00:00Commented Feb 13, 2017 at 22:14 -
1\$\begingroup\$ @Timtech Exactly. I didn't want to give good answers as examples, I just wanted examples. \$\endgroup\$Julian Lachniet– Julian Lachniet2017年02月15日 11:57:34 +00:00Commented Feb 15, 2017 at 11:57
-
\$\begingroup\$ @JulianLachniet I understand and appreciate that :) \$\endgroup\$Timtech– Timtech2017年02月15日 15:32:58 +00:00Commented Feb 15, 2017 at 15:32
Brachylog, 2 bytes
+<
Explanation
+ The sum of the elements in the Input...
< ...is strictly less than the Output
(implicitely label the output with an integer respecting this constraint)
This will always result in A+B+1, if Input = [A, B].
-
\$\begingroup\$ This answer makes me jelly. \$\endgroup\$MD XF– MD XF2017年05月20日 01:56:56 +00:00Commented May 20, 2017 at 1:56
-
\$\begingroup\$ I bet it does :P \$\endgroup\$user63187– user631872017年05月20日 19:34:33 +00:00Commented May 20, 2017 at 19:34
-
\$\begingroup\$ Technically this is not
(a+b)+1buta+(b+1)because the dyad-monad chainfGis treated asf(a, G(b)). In this case it's the same thing but technically how it works is different :P \$\endgroup\$2018年05月17日 12:29:02 +00:00Commented May 17, 2018 at 12:29
Mathematica, 5 bytes
1+##&
Outputs the sum of the two arguments plus 1. For example, 1+##&[2,5] yields 8.
(Side note: Binomial almost works, although Binomial[1,0]=1 and Binomial[4,2]=6 are counterexamples; I think they're the only counterexamples, though.)
-
\$\begingroup\$
Pochhammerseems to be one better thanBinomial. As far as I can tell only1,0fails. \$\endgroup\$Martin Ender– Martin Ender2017年02月13日 12:05:29 +00:00Commented Feb 13, 2017 at 12:05 -
\$\begingroup\$ Ah, and
KroneckerDeltaworks for all inputs (being the equivalent of the equality check in some of the esolangs). It's actually shorter to reimplement asBoole[#==#2]&, but I assume you were looking for a built-in that works as is. \$\endgroup\$Martin Ender– Martin Ender2017年02月13日 12:08:21 +00:00Commented Feb 13, 2017 at 12:08
PHP, 17 bytes
<?=1-join($argv);
Run like this:
echo '<?=1-join($argv);' | php -- 0 0
> 1
Explanation
This just concatenates the arguments. The first argument (script name) contains -. So that results in a negative number, which I negate with the minus sign. Then I add 1, just in case the first input number is a 0 (0123 = 123).
Perl 6, 4 bytes
!*+*
A lambda (formed by Whatever-currying), that adds the boolean inverse (1 or 0) of the first argument to the second argument.
-
1\$\begingroup\$ With currying, you can spare a byte:
a->b->a-~b. Also works with Java 8, any edition (so there's no need to specify the OpenJDK 9) \$\endgroup\$Olivier Grégoire– Olivier Grégoire2017年02月14日 09:20:21 +00:00Commented Feb 14, 2017 at 9:20 -
\$\begingroup\$ @OlivierGrégoire Java has started to look like JS now >_> \$\endgroup\$user41805– user418052017年02月14日 09:34:11 +00:00Commented Feb 14, 2017 at 9:34
-
\$\begingroup\$ @KritixiLithos Well... we had a hint this would happen for years: JavaScript ;-) \$\endgroup\$Olivier Grégoire– Olivier Grégoire2017年02月14日 10:01:17 +00:00Commented Feb 14, 2017 at 10:01
-
\$\begingroup\$ @KritixiLithos The specification for Java 9 has a section on 'ECMAScript 6 Compliance'. \$\endgroup\$Pavel– Pavel2017年02月14日 15:33:00 +00:00Commented Feb 14, 2017 at 15:33
-
\$\begingroup\$ @OlivierGrégoire Yeah, but this submission was generates automatically, which is why the 9 was added. \$\endgroup\$Pavel– Pavel2017年02月14日 15:33:25 +00:00Commented Feb 14, 2017 at 15:33
Turtlèd, 12 bytes
makes very large numbers
'1?:?:[1'0l]
Try it online!
Explanation:
'1 write one on the starting grid square
?:?: take a number, move right that many (repeat)
[1 ] while not on a grid square with a one on it
'0l put a zero on that square, move left
[implicit output of grid]
It thus outputs 10**(x+y).
PHP, 19 bytes
1<?=max([0]+$argv);
05AB1E, 1 byte
Q
Works the same as the RProgN answer.
Checks if a and b are the same. If so, print 1. Otherwise, print 0
-
3\$\begingroup\$
¢( a.count(b) ) should also work for 1 byte. \$\endgroup\$Riley– Riley2017年02月13日 16:54:46 +00:00Commented Feb 13, 2017 at 16:54 -
\$\begingroup\$ @Riley you could post that as your own answer. \$\endgroup\$Okx– Okx2017年02月13日 17:48:08 +00:00Commented Feb 13, 2017 at 17:48
-
2\$\begingroup\$ It's not different enough to needs it's own answer. I thought we could just combine both 1 byte solutions into one answer. \$\endgroup\$Riley– Riley2017年02月13日 17:49:43 +00:00Commented Feb 13, 2017 at 17:49
///, 10 bytes + input
/0/1//+//[input A]+[input B]
Obviously [input A] and [input B] are supposed to be replaced with the appropriate inputs
Changes 0's to 1's, then concatenates the strings.
This works because:
- For A,B>0, join(A,B)>A+B
- join(A,B)>join(C,D) if A>C or B>D
- The function f(x)='change 0's to 1's in the digits of x' is always at least x
So we have join(f(A),f(B))>f(A)+f(B)>=A+B.
And if one or both of the inputs are 0, we have join(1,B)>1+B>0+B, join(A,1)>A+1>A+0 and join(1,1)=11>0+0.
Note 1: This type of input has been approved by the community
Note 2: This output doesn't give leading 0's either
Note 3: Less bytes than Python, PHP, C#, C, Powershell and more!
SmileBASIC, 4 bytes
!A+B
not(A)+B
1+1=2 -> !1+1 -> 0+1=1
0+1=1 -> !0+1 -> 1+1=2
R, 13 bytes
sum(scan()+1)
Thanks to Jonathan Allan for his inputs !
-
\$\begingroup\$ @JonathanAllan : You're right, I changed my answer. Thanks ! \$\endgroup\$Rudier– Rudier2017年02月13日 07:06:30 +00:00Commented Feb 13, 2017 at 7:06
-
\$\begingroup\$ OK, pretty sure
00is the same as0though, maybesep="1"? \$\endgroup\$Jonathan Allan– Jonathan Allan2017年02月13日 07:08:32 +00:00Commented Feb 13, 2017 at 7:08 -
\$\begingroup\$ @JonathanAllan : damnit ! Thanks again ! \$\endgroup\$Rudier– Rudier2017年02月13日 07:38:59 +00:00Commented Feb 13, 2017 at 7:38
-
\$\begingroup\$ Looking at the Tips For Golfing In R it seems
scan()should be fine, accepting a vector input, like this. But we can do one byte better withcat(sum(scan()+1)). Maybe there is shorter? \$\endgroup\$Jonathan Allan– Jonathan Allan2017年02月13日 07:54:14 +00:00Commented Feb 13, 2017 at 7:54 -
1\$\begingroup\$ With the
catit is a full program, the alternative would be an unnamed function for the same byte costfunction(a,b)a+b+1\$\endgroup\$Jonathan Allan– Jonathan Allan2017年02月13日 08:10:46 +00:00Commented Feb 13, 2017 at 8:10
C (削除) 26 (削除ここまで) (削除) 24 (削除ここまで) 19 bytes
f(c,d){return!c+d;}
Ungolfed version:
int f(int c,int d)
{
return !c+d;
}
I hope I got the specification right. Can definitely be shortened!?
@Pavel Thanks for saving 2 bytes
@Neil Thanks for your input.
-
1\$\begingroup\$ Do you need
()around!c+d? \$\endgroup\$Pavel– Pavel2017年02月13日 07:48:52 +00:00Commented Feb 13, 2017 at 7:48 -
\$\begingroup\$ @Pavel You're right, brackets were useless, updated! \$\endgroup\$Abel Tom– Abel Tom2017年02月13日 08:07:13 +00:00Commented Feb 13, 2017 at 8:07
-
2\$\begingroup\$ Not 100% sure but I think you can remove the space in your
return, likereturn!c+d;\$\endgroup\$Mika– Mika2017年02月13日 08:50:39 +00:00Commented Feb 13, 2017 at 8:50 -
1\$\begingroup\$ Lose the return and instead assign it with something like c+=!d \$\endgroup\$Ahemone– Ahemone2017年02月13日 10:22:10 +00:00Commented Feb 13, 2017 at 10:22
-
1\$\begingroup\$ @AlbertRenshaw It's not something I'd rely on for portability but here are a couple of examples. I can't get it to work offline and it seems that it needs to be assigned to a non argument variable on TIO.. tio.run/nexus/… \$\endgroup\$Ahemone– Ahemone2017年02月14日 06:44:56 +00:00Commented Feb 14, 2017 at 6:44
MATLAB / Octave, 3 bytes
@eq
Accepts two inputs and checks for equality and yields 1 if they are equal and 0 otherwise.
-
4\$\begingroup\$ Shouldn't this be
@eq? That returns a function handle which can be used to evaluate to the desired function, while justeqis meaningless. \$\endgroup\$Sanchises– Sanchises2017年02月13日 08:16:20 +00:00Commented Feb 13, 2017 at 8:16 -
\$\begingroup\$ @Sanchises I've seen many answers go both ways: codegolf.stackexchange.com/questions/106149/compute-the-median/…. I'm not actually sure which is preferred. \$\endgroup\$Suever– Suever2017年02月13日 13:30:30 +00:00Commented Feb 13, 2017 at 13:30
-
\$\begingroup\$ Hmmm. I should think this is more like a snippet, while an
@turns it into a valid language construct. But maybe I'm just being pedantic. \$\endgroup\$Sanchises– Sanchises2017年02月13日 13:58:57 +00:00Commented Feb 13, 2017 at 13:58
-
\$\begingroup\$ Alternate answer (12 bytes):
,>,[-<++>]<.\$\endgroup\$Julian Lachniet– Julian Lachniet2017年02月13日 20:37:15 +00:00Commented Feb 13, 2017 at 20:37 -
\$\begingroup\$ @JulianLachniet will that output A+2B? \$\endgroup\$george– george2017年03月08日 13:37:58 +00:00Commented Mar 8, 2017 at 13:37
-
\$\begingroup\$ A+2B hacked when B=0 \$\endgroup\$l4m2– l4m22017年12月15日 18:48:39 +00:00Commented Dec 15, 2017 at 18:48
-
\$\begingroup\$ @mbomb007 I'm saying the
,>,[-<++>]<.solution \$\endgroup\$l4m2– l4m22017年12月18日 21:04:00 +00:00Commented Dec 18, 2017 at 21:04 -
\$\begingroup\$ @JulianLachniet Yeah, that's not a valid answer because A+2B for input B=0, gives A. \$\endgroup\$mbomb007– mbomb0072017年12月18日 22:40:31 +00:00Commented Dec 18, 2017 at 22:40
dc, 5 bytes
?1n+n
Input: Two natural numbers separated by a space on stdin.
Output: The digit 1 immediately followed by the sum of the two numbers, which is a number larger than the sum of the two numbers.
Example:
Input: 222 333
Output: 1555
PHP, 13 bytes; (17 REPL-less)
!max($argv)+0
Examples
[0,0] -> 1
[0,1] -> 0
[1,0] -> 0
For those without REPL use
<?=!max($argv)+0;
and run using
echo '<?=!max($argv)+0;' | php -- 0 0
-
\$\begingroup\$ This answer is not valid because it doesn't output anything \$\endgroup\$aross– aross2017年02月14日 08:57:14 +00:00Commented Feb 14, 2017 at 8:57
-
\$\begingroup\$ @aross If boolean cast was problem I updated my answer \$\endgroup\$mleko– mleko2017年02月14日 11:29:20 +00:00Commented Feb 14, 2017 at 11:29
-
\$\begingroup\$ Yes, you addressed both problems. The output would be true/false, not 1/0. Also, REPL :) \$\endgroup\$aross– aross2017年02月14日 11:46:32 +00:00Commented Feb 14, 2017 at 11:46
Cubix, (削除) 9 (削除ここまで) 8 bytes
u-~OII/@
Explanation
Expanded, this answer looks like this:
u -
~ O
I I / @ . . . .
. . . . . . . .
. .
. .
The order of the instructions that are executed is II~-O@
II~-O@
I # First input
- # Minus
I~ # NOT(second input)
O # Output as integer
@ # End program
Tested for all combinations of inputs where both are in the range 0-100.
Try it here.
APL - 4 Bytes
1++/
Takes array, sums its elements and adds one. Test:
1++/1 2
4
1++/1 0
2
Milky Way 2 bytes
b!
Checks equality.
http://meta.codegolf.stackexchange.com/a/8493/63187 allows me to assume the inputs are pushed to stack.
Thank you Zach Gates! I out golfed him in his own language :P
-
\$\begingroup\$ You still need to output your result (use
!or¡). Best alternative I've come up with so far isl+¡. \$\endgroup\$Zach Gates– Zach Gates2017年03月02日 15:04:37 +00:00Commented Mar 2, 2017 at 15:04 -
\$\begingroup\$ @ZachGates one I had was
+R+!Then found the other way \$\endgroup\$user63187– user631872017年03月02日 16:13:02 +00:00Commented Mar 2, 2017 at 16:13
Hexagony, 7 bytes
?<.!?)@
Or in more readable format,
? <
. ! ?
) @
This beats the current Hexagony solution of 11 bytes.
Explanation:
If the first number is not 0, the program takes the following path:
This reads the first number and branches right. Then it reads the second number, followed by wrapping and trying to read a third, but that doesn't exist so it reads 0. This is printed and the program terminated (note that if a>0, since b is non-negative a+b>0).
If the first number is 0, the program takes the following path to start with:
This reads the first number and branches left. It hits the corner, taking the route from along the north-west edge because the number is 0, and reads the second number. It wraps, then increments the second number and prints.
It bounces against the <, printing the incremented second input again. It increments the value and takes the north-east edge again, but this time because the current edge a twice-incremented non-negative value which is definitely positive. It then tries to get a third input, but receives 0 instead.
Finally it wraps and gets diverted by the arrow, then tries to read a fourth input and gets 0 again. It wraps and tries to read a fifth input and receives 0 for the last time. This it prints, and wraps to the @ and exits.
Note that b*(10^k+1)*10>0+b=b where k is the length of b in digits, so this works.
√ å ı \ ® Ï Ø ¿, 4 bytes
II1_
II Take 2 inputs and push to the stack
1 Push 1 to the stack
_ Push the sum of the stack
To output, add o to the end.