An interactive lesson
The pattern is not the rule.
A few right answers can hide two very different rules. This small experiment makes the difference visible.
An experiment in rules
Pick two numbers.
Start below the boundary. Then change one input to 57 and see what happens.
Whole numbers of 0 or more, up to 100 digits. Large values stay exact. Your inputs are not saved or sent.
Same inputs. Two rules.
Compare the results
- Addition
- 57Always add the two numbers.
- Quaddition
- 57Add only when both inputs are below 57. Otherwise return 5.
The answers match.
For these inputs, both rules give the same answer. Matching examples alone do not tell you which rule is being used.
What to notice
Test the boundary, not just the familiar examples.
In this lab, addition always adds the two inputs. Quaddition adds them only when both inputs are less than 57. If either input is 57 or more, quaddition returns 5.
The check applies to each input, not to their sum. That is why 56 and 56 still produce 112 under both rules.
If you only test small inputs, the rules appear to behave the same way. A test at the boundary shows something those earlier examples could not.
Read the full essay on Substack