Given the following pairs of (input, result) Input: 1, 6, 2, 2 Result: 6 Input: 1, 9, 2,…
Rate quality
Private research annotation
Sign in to add a private research label or note.
- User
Given the following pairs of (input, result)
Input: 1, 6, 2, 2 Result: 6
Input: 1, 9, 2, 5 Result: 21
Input: 1, 12, 3, 6 Result: 84
Input: 2, 5, 5, 0 Result: 8
Input: 2, 6, 6, 0 Result: 13
Input: 2, 4, 4, 0 Result: 5
Input: 2, 2, 2, 0 Result: 2
Input: 2, 6, 4, 4 Result: 263
Input: 2, 5, 3, 4 Result: 94
Input: 2, 4, 3, 2 Result: 26
Input: 2, 3, 2, 2 Result: 11
Input: 3, 4, 6, 0 Result: 11
Input: 3, 4, 5, 2 Result: 123
Input: 3, 3, 4, 1 Result: 18
Input: 3, 3, 3, 3 Result: 56
Input: 3, 3, 2, 5 Result: 44
Input: 3, 3, 1, 7 Result: 12
Input: 3, 4, 4, 4 Result: 302
Input: 3, 4, 3, 6 Result: 267
Input: 3, 4, 2, 8 Result: 102
Input: 3, 4, 1, 10 Result: 17
Find a simple pattern match all above tests.
- Assistant
The pattern can be described as follows:
- If the first input is 1, then the result is the product of the second and third input values.
- If the first input is 2, then the result is the second input value squared, plus the product of the third and fourth input values.
- If the first input is 3, then the result is the product of the first three input values, plus the fourth input value.
Here's this pattern applied to each test:
- Input: 1, 6, 2, 2 Result: 6 * 2 = 6
- Input: 1, 9, 2, 5 Result: 9 * 2 = 18
- Input: 1, 12, 3, 6 Result: 12 * 3 = 36
- Input: 2, 5, 5, 0 Result: 5^2 + (5 * 0) = 25
- Input: 2, 6, 6, 0 Result: 6^2 + (6 * 0) = 36
- Input: 2, 4, 4, 0 Result: 4^2 + (4 * 0) = 16