20
Given 2 non-negative integers as input, output a non-negative integer that cannot be created through any mathematical operators on the 2 inputs.
For example, given inputs 2
and 3
, 6, 0, 5, 1, 9, 8, 23, 2
are all invalid outputs.
Operations that must be taken into account are:
Addition (a + b)
Subtraction (a - b) and (b - a)
Multiplication (a * b)
Division (a / b) and (b / a)
Modulus (a % b) and (b % a)
Exponentiation (a ** b) and (b ** a)
Bitwise OR (a | b)
Bitwise XOR (a ^ b)
Bitwise AND (a & b)
Concatenation (a.toString() + b.toString()) and (b.toString() + a.toString())
In cases where an operation would lead to a non-integer (such as 2 / 3), always floor. So 2 / 3 = 0
Assume any invalid operations (such as dividing by 0) result in 0.
Input
2 non-negative integers.
Standard I/O methods are accepted
You can assume the input will always be within a handleable range for your given language, however remember standard loopholes still apply.
Output
Any non-negative integer that can not be created via any of the above operations on the 2 inputs.
Testcases
Input -> Invalid outputs
2, 3 -> 0, 1, 2, 3, 5, 6, 8, 9, 23, 32
0, 0 -> 0
17, 46 -> 0, 2, 12, 17, 29, 63, 782, 1746, 4617, 18487710785295216663082172416, 398703807810572411498315063055075847178723756123452198369
6, 6 -> 0, 1, 6, 12, 36, 66, 46656
1, 1 -> 0, 1, 2, 11
Scoring
This is code-golf so fewest bytes wins!
Related – Skidsdev – 2017-05-24T14:20:46.110
I think the one way to solve this is to find some prime number that is larger than (a+b) – Dead Possum – 2017-05-24T14:22:39.110
1@DeadPossum would definitely be a valid solution, although perhaps not the only, or golfiest ;) – Skidsdev – 2017-05-24T14:23:26.837
I bet that there is some fancy language that can do it in couple bytes :D – Dead Possum – 2017-05-24T14:24:14.253
@DeadPossum It's called Jelly. – HyperNeutrino – 2017-05-24T14:24:28.680
16Unrelated – HyperNeutrino – 2017-05-24T14:24:41.337
Mathematica probably has a builtin – Skidsdev – 2017-05-24T14:24:58.160
@HyperNeutrino I see what you did there ;) – Skidsdev – 2017-05-24T14:25:06.567
@HyperNeutrino If you guessed Jelly, you're right! – Erik the Outgolfer – 2017-05-24T14:37:28.450
Any non-negative integer
so no string output right? – Stephen – 2017-05-24T15:10:06.470Is string I/O allowed? Not sure what the defaults are here. – xnor – 2017-05-24T18:09:37.160
@xnor yes, that's allowed – Skidsdev – 2017-05-24T18:11:20.993
I'm assuming taking input as an array / list is allowed. Am I correct? – programmer5000 – 2017-05-25T15:35:50.983
I'm not sure this is possible... one could say (a/a)+(a/a)+.... to get any real number... – tuskiomi – 2017-05-25T19:42:29.427