How many 9's are sandwiched between 6 and 7 in the following sequence:
6 9 6 9 9 6 6 7 6 9 7 9 6 6 9 7 7 9 6 6 7?
- A2
- B3
- C4
- D5
Solution & Step-by-step Explanation
A digit 9 is "sandwiched" between 6 and 7 if it forms either the combination 6-9-7 or 7-9-6. Let's scan the given sequence step-by-step to find these targeted strings:
Given sequence:
6 9 6 9 9 6 6 7 [6 9 7] 9 6 6 [6 9 7] 7 9 6 6 7
Let's locate occurrences:
1. ... 6 7 6 9 7 9 ... Found 1 (6-9-7)
2. ... 6 6 6 9 7 7 ... Found 2 (6-9-7)
Scanning other 9s:
* The first 9 is between 6 and 6 (6-9-6).
* The second and third 9s are adjacent (6-9-9-6).
* The 9 after the first match is followed by 6 (7-9-6 is missing because the sequence goes
The sub-sequence is
Let's trace it fully:
* The last 9 is between 7 and 6 (
Let's check indices carefully:
Elements:
1: 6
2: 9 (6-9-6)
3: 6
4: 9 (6-9-9)
5: 9 (9-9-6)
6: 6
7: 6
8: 7
9: 6
10: 9 (6-9-7) Match 1
11: 7
12: 9 (7-9-6) Match 2
13: 6
14: 6
15: 9 (6-9-7) Match 3
16: 7
17: 7
18: 9 (7-9-6) Match 4
19: 6
20: 6
21: 7
Total instances of a 9 sandwiched precisely between a 6 and a 7 (in either order) is 4.
Given sequence:
6 9 6 9 9 6 6 7 [6 9 7] 9 6 6 [6 9 7] 7 9 6 6 7
Let's locate occurrences:
1. ... 6 7 6 9 7 9 ... Found 1 (6-9-7)
2. ... 6 6 6 9 7 7 ... Found 2 (6-9-7)
Scanning other 9s:
* The first 9 is between 6 and 6 (6-9-6).
* The second and third 9s are adjacent (6-9-9-6).
* The 9 after the first match is followed by 6 (7-9-6 is missing because the sequence goes
6 9 7 9 6, so that 9 is between 7 and 6, making a 7-9-6 pattern at 7 9 6!) Let's re-verify:The sub-sequence is
6 9 7 9 6. Here we have 6 9 7 (one match) and immediately following it is 7 9 6 (another match).Let's trace it fully:
6 7 [6 9 7] 9 6 ... The 9 is between 6 and 7 (6 9 7), and the next 9 is between 7 and 6 (7 9 6).* The last 9 is between 7 and 6 (
7 9 6).Let's check indices carefully:
Elements:
1: 6
2: 9 (6-9-6)
3: 6
4: 9 (6-9-9)
5: 9 (9-9-6)
6: 6
7: 6
8: 7
9: 6
10: 9 (6-9-7) Match 1
11: 7
12: 9 (7-9-6) Match 2
13: 6
14: 6
15: 9 (6-9-7) Match 3
16: 7
17: 7
18: 9 (7-9-6) Match 4
19: 6
20: 6
21: 7
Total instances of a 9 sandwiched precisely between a 6 and a 7 (in either order) is 4.