24
7
There have been many "Do __ without __" challenges before, but I hope that this is one of the most challenging.
The Challenge
You are to write a program that takes two natural numbers (whole numbers > 0) from STDIN, and prints the sum of the two numbers to STDOUT. The challenge is that you must use as few +
and -
signs as possible. You are not allowed to use any sum-like or negation functions.
Examples
input
123
468
output
591
input
702
720
output
1422
Tie Breaker:
If two programs have the same number of +
and -
characters, the winner is the person with fewer /
*
(
)
=
.
,
and 0-9
characters.
Not Allowed: Languages in which the standard addition/subtraction and increment/decrement operators are symbols other than +
or -
are not allowed. This means that Whitespace the language is not allowed.
Concatenating strings works? – user75200 – 2018-01-06T20:06:29.130
Are languages allowed that don't have arithmetic operators at all? I think that last sentence permits them, but it's not completely clear. – Toby Speight – 2018-08-01T15:39:43.603
Fewer
(
and)
puts Lisps at a disadvantage. :( – Joshua Taylor – 2014-02-20T21:05:34.683Next challenge would be "Comparing two numbers without any of ><+-*/%&|" – Naruyoko – 2019-09-19T23:41:33.640
1Perhaps this challenge was a lot easier than I thought it would be, especially in other languages, where there are sum() functions. I have to fix this. – PhiNotPi – 2011-12-01T00:45:46.310
50100 rep bounty for anybody who can do this in Brainfuck. – Peter Olson – 2011-12-01T05:57:36.263
3@Peter Olson Well, I guess BF is not turing complete without either
+
or-
... – FUZxxl – 2011-12-01T10:21:55.7633Just to clarify, this challenge does not care about code length right? Only the number of
+
,-
and tie breaker characters? ...or do you need to change the rules again :-) – Tommy – 2011-12-01T19:39:51.977@Tommy No, it does not. – PhiNotPi – 2011-12-01T21:58:45.160
@PeterOlson: I'd be even more impressed if someone can do it in Malbolge
– Kris – 2011-12-07T21:13:48.763