To solve the problem, we need to determine the maximum number of trials necessary to obtain the correct 4-digit ATM pin code, given the conditions stated in the problem.
1. Understanding the Conditions:
- The pin code consists of 4 different digits.
- The greatest digit is 7.
- The sum of the first two digits equals the sum of the last two digits.
2. Identifying Possible Digits:
- Since the greatest digit is 7, the possible digits for the pin code are {0, 1, 2, 3, 4, 5, 6, 7}.
3. Setting Up the Equation:
- Let the digits be represented as A, B, C, and D.
- From the problem, we have the equation:
A+B=C+D
4. Finding Possible Values for A + B:
- The maximum value for A + B can be 14 (if A = 7 and B = 6).
- The minimum value for A + B can be 1 (if A = 0 and B = 1).
- Therefore, A + B can take values from 1 to 14.
5. Calculating Possible Combinations:
- We need to find pairs (A, B) such that A + B = k, where k is the sum of the first two digits.
- For each k, we will find the corresponding pairs (C, D) such that C + D = k.
6. Counting Valid Combinations:
- For each possible value of k, we will count the valid pairs (A, B) and (C, D) ensuring all digits are different.
- The valid pairs for each k are:
- k = 1: (0, 1) → C + D = 1 (not possible)
- k = 2: (0, 2) → C + D = 2 (not possible)
- k = 3: (1, 2) → C + D = 3 (0, 3)
- k = 4: (1, 3), (0, 4) → C + D = 4 (0, 4)
- k = 5: (1, 4), (2, 3) → C + D = 5 (0, 5)
- k = 6: (1, 5), (2, 4), (3, 3) → C + D = 6 (0, 6)
- k = 7: (1, 6), (2, 5), (3, 4) → C + D = 7 (0, 7)
- k = 8: (2, 6), (3, 5) → C + D = 8 (1, 7)
- k = 9: (3, 6) → C + D = 9 (2, 7)
- k = 10: (4, 6) → C + D = 10 (3, 7)
- k = 11: (5, 6) → C + D = 11 (4, 7)
- k = 12: (5, 7) → C + D = 12 (5, 7)
- k = 13: (6, 7) → C + D = 13 (6, 7)
7. Calculating Total Combinations:
- For each valid pair (A, B), there are two arrangements (AB and BA).
- Therefore, if we find n valid pairs, the total number of combinations would be n×2.
8. Final Calculation:
- After counting all valid pairs, we find that there are 18 valid combinations.
- Thus, the maximum number of trials necessary to obtain the correct code is:
18×2=36
Conclusion:
The maximum number of trials necessary to obtain the correct code is 36.