Pattern Recognition Examples in CS Thinking

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Pattern Recognition.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in CS Thinking.

Concept Recap

Pattern recognition is the process of identifying similarities, trends, or regularities across data or problems in order to build general solutions. By spotting what is the same across different cases, you can create reusable strategies instead of solving each case from scratch.

Spotting what's the same across different examples so you can apply one solution to many.

Read the full concept explanation β†’

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: Patterns let you predict and generalize from specific cases.

Common stuck point: Correlation isn't causationβ€”patterns can be coincidental and misleading without careful testing.

Sense of Study hint: When looking for patterns, first collect several specific examples or cases. Then compare them side by side and ask 'What stays the same? What changes? Is there a rule?' Finally, test your proposed pattern against new examples to verify it holds.

Worked Examples

Example 1

easy
Look at the sequence: 2, 6, 18, 54, ... Identify the pattern and predict the next number.

Answer

162162. The pattern is multiplying by 3.

First step

1
Step 1: Check differences: 6βˆ’2=4, 18βˆ’6=12, 54βˆ’18=36. The differences are not constant.

Full solution

  1. 2
    Step 2: Check ratios: 6/2=3, 18/6=3, 54/18=3. Each term is multiplied by 3.
  2. 3
    Step 3: Next number: 54Γ—3=16254 \times 3 = 162.
Pattern recognition involves identifying regularities and trends. Recognising that a sequence multiplies by a constant factor (geometric sequence) lets us predict future values.

Example 2

medium
Three programs are described: (a) calculates total price of items in a shopping cart, (b) calculates total marks of a student across subjects, (c) calculates total rainfall over a week. What pattern do they share?

Example 3

easy
Three problems: (1) total cost of items, (2) total points in a game, (3) total minutes practiced this week. Name the shared algorithm pattern.

Example 4

medium
A table shows inputs 0,1,2,3 mapping to 1,3,5,7. Find the rule and give the output for input 8.

Example 5

medium
A server crashes at exactly 03:00 on Monday, Wednesday, and Friday. What pattern should you flag, and what hypothesis follows?

Example 6

hard
In a multiplication table, the sum of the first n rows equals 1+2+...+n times the same. Show that summing row k gives kβ‹…n(n+1)2k \cdot \frac{n(n+1)}{2} and use it to find the sum of all entries in a 4x4 table.

Example 7

challenge
Pascal's triangle row n is 1, n, n(n-1)/2, ... The third entry of row 8 is what?

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

easy
Identify the pattern: Monday β†’ M, Tuesday β†’ T, Wednesday β†’ W. How would you extract the first letter of any day?

Example 2

medium
Three tasks all require counting items that meet a condition: counting even numbers in a list, counting absent students, and counting defective bulbs. What common algorithm pattern can be reused?

Example 3

easy
What comes next in the pattern 2, 4, 6, 8, ___?

Example 4

easy
Find the rule and next term: 3, 6, 12, 24, ___.

Example 5

easy
The pattern is: a_n = 2n. What is the 5th term (n=5)?

Example 6

easy
Which shapes share a pattern: a red circle, a red square, a red triangle? What is the same?

Example 7

easy
Next term: 1, 4, 9, 16, ___ (hint: squares).

Example 8

easy
In the words CAT, COT, CUT, what stays the same and lets you predict the form of the next such word?

Example 9

easy
A login fails at 2am, 2am, and 2am on three days. What pattern should you flag?

Example 10

easy
Find the next term: 5, 10, 15, 20, ___.

Example 11

medium
Find a closed-form rule for 3, 5, 7, 9, ... and use it to get the 10th term.

Example 12

medium
The differences of 2, 5, 10, 17 are 3, 5, 7. What is the next term?

Example 13

medium
Spot the pattern in the function table: f(1)=2, f(2)=4, f(3)=8, f(4)=16. What is f(5)?

Example 14

medium
A list of test scores is 88, 90, 89, 91, 90. A new score is 250. What pattern-based judgment should you make about 250?

Example 15

medium
Two students see 1,2,4,7,11 and disagree. Find the rule (differences) and the next term.

Example 16

medium
A pattern holds for n=1,2,3 but you must check it is not a coincidence. Why is testing only 3 cases risky?

Example 17

medium
Recognize the pattern: the Fibonacci-style sequence 1, 1, 2, 3, 5, 8 has each term as the sum of the two before. What is the next term?

Example 18

medium
Find the rule for 1, 3, 9, 27 and give the next term.

Example 19

medium
A table shows inputs 1,2,3,4 mapping to 1,3,5,7. Find the rule and the output for input 6.

Example 20

challenge
A sequence is 2, 6, 12, 20, 30. Find a closed-form ana_n and give a6a_6.

Example 21

challenge
In a multiplication table, the diagonal is 1,4,9,16,25. Explain the pattern and predict the 7th diagonal entry.

Example 22

challenge
A logfile shows requests at seconds 0, 3, 6, 9, 12 then a gap, then 20, 23, 26. Identify both patterns and predict the next request after 26.

Example 23

easy
What comes next in 7, 14, 21, 28, ___?

Example 24

easy
Find the next term: 100, 90, 80, 70, ___.

Example 25

easy
What is the next letter in A, C, E, G, ___?

Example 26

easy
What is the next number: 1, 2, 4, 8, 16, ___?

Example 27

easy
Find the next term: 0, 1, 2, 3, 5, 8, 13, ___.

Example 28

medium
For the sequence an=3nβˆ’1a_n = 3n - 1, what is a10a_{10}?

Example 29

medium
Find the rule for 4, 9, 16, 25 and give the next term.

Example 30

medium
Two tasks: (a) counting vowels in a string; (b) counting odd numbers in a list. What shared algorithm pattern do they use?

Example 31

medium
Find a closed-form rule for 5, 8, 11, 14, ... and the 20th term.

Example 32

medium
The differences of 1, 4, 9, 16, 25 are 3, 5, 7, 9. What pattern does this expose?

Example 33

medium
Find the next term in 2, 6, 18, 54, ___.

Example 34

medium
Three programs (sum a column, average a column, find max in a column) share what structural pattern?

Example 35

medium
A pattern is observed in 3 examples. Why is that NOT yet a proof?

Example 36

hard
Find a closed-form for 1, 3, 6, 10, 15 and use it to find the 8th term.

Example 37

hard
You see 1, 11, 21, 1211, 111221. What is the next term (this is the 'look-and-say' sequence)?

Example 38

hard
A pattern holds for n=1, 2, 3, 4 but fails at n=5. What lesson does this illustrate?

Example 39

hard
Recognize the pattern: the powers of 2 are 1, 2, 4, 8, 16, 32. What is 2102^{10}?

Example 40

hard
In the sequence 2, 12, 36, 80, 150, ..., recognize a polynomial pattern. Each term is n2(n+1)n^2(n+1). What is the 6th term?

Example 41

challenge
Correlation vs causation: midweek ice-cream sales and midweek drownings both spike. Why is it WRONG to conclude ice cream causes drowning?