Coding activity
Recursion Russian Dolls
Discover patterns inside patterns! Draw a big circle, then a smaller circle inside, then an even smaller one. Like Russian nesting dolls, the same shape repeats at different sizes.
Materials and setup
- paper
- markers
- rulers
- colored pencils
How this changes by age
Pre-K (ages 3–4)
Discover patterns inside patterns! Draw a big circle, then a smaller circle inside, then an even smaller one. Like Russian nesting dolls, the same shape repeats at different sizes.
Steps
- Show nesting cups or draw concentric circles: big, medium, small, tiny.
- Ask: 'What do you notice? The same shape gets smaller and smaller!'
- Draw your own: start with a big triangle. Draw a smaller triangle inside. Then an even smaller one inside that.
- Try with squares: big square, smaller square inside, even smaller inside.
- Count: how many levels deep can you go? 'Each level is the same pattern, just smaller!'
- Tell a grown-up one thing that surprised you.
Learning objectives
- Recognize that the same shape can repeat at different sizes
- Draw nested patterns by repeating a smaller version inside a larger one
- Count the levels of nesting in a pattern
Kindergarten (ages 5–6)
Make fractal art! Draw a shape, then draw smaller copies of it inside or around it. Each copy follows the same rule. Discover how nature uses this trick in trees, ferns, and snowflakes.
Steps
- Draw a big Y shape (like a tree trunk splitting into branches).
- At the end of each branch, draw a smaller Y. At the end of those branches, draw an even smaller Y.
- You just drew 3 levels of a fractal tree! How many branch tips do you have?
- Try another pattern: draw a triangle. At each corner, draw a smaller triangle. At each of those corners, draw an even smaller one.
- Look at real examples: a fern leaf, broccoli, snowflake photos. Can you see the repeating pattern?
- Tell a grown-up one thing that surprised you.
Learning objectives
- Create fractal drawings by applying the same rule at smaller scales
- Count how elements multiply at each level of recursion
- Identify self-similar patterns in nature
Early elementary (ages 6–8)
Explore recursion through drawing and math! Understand the idea of a function that calls itself with a smaller input. Draw fractals, calculate recursive sequences, and discover the power of self-reference.
Steps
- Recursion in action: 'To clean your room, first clean one item. Then clean your room (which now has one fewer item).' The instruction refers to itself!
- Draw a Sierpinski Triangle: start with a big triangle. Find the midpoints of each side and connect them, creating 4 smaller triangles. Remove the middle one. Repeat for each remaining triangle.
- Calculate: at level 0, you have 1 triangle. Level 1: 3 triangles. Level 2: 9 triangles. Level 3: 27. What is the pattern? (Multiply by 3 each level.)
- Write a recursive instruction: 'To count down from N: say N, then count down from N-1. Stop when N is 0.' Trace through: countdown(5) = 5, 4, 3, 2, 1, 0.
- Try factorial: 'factorial(N) = N times factorial(N-1). factorial(1) = 1.' Calculate factorial(5) = 5 x 4 x 3 x 2 x 1 = 120.
- Discuss: 'Every recursion needs a stopping point (base case) or it goes forever! What is the base case in our examples?'
- In one sentence, tell a parent or sibling what surprised you today.
Learning objectives
- Understand recursion as a process that refers to itself with a smaller input
- Draw multi-level fractal patterns by applying recursive rules
- Identify the base case that stops a recursive process from running forever
Upper elementary (ages 8–10)
Master recursion as a programming concept. Trace through recursive function calls using a call stack, compare recursive and iterative solutions, and understand when recursion is elegant versus when it is inefficient.
Steps
- Draw a call stack for factorial(4): factorial(4) calls factorial(3) calls factorial(2) calls factorial(1)=1, then results flow back up: 1, 2, 6, 24.
- Fibonacci recursion: fib(n) = fib(n-1) + fib(n-2), fib(1)=fib(2)=1. Draw the call tree for fib(6). How many times does fib(2) get calculated? (Too many times!)
- Compare: write the iterative (loop) version of Fibonacci on paper. Count operations for both. Which is more efficient?
- Recursive drawing challenge: write the instructions for a Koch Snowflake. At each level, replace the middle third of each line segment with a triangle bump. Draw levels 0, 1, 2, and 3.
- Real-world recursion: file folders contain files and other folders (which contain files and other folders...). Design a 'search every file' algorithm using recursion.
- Discuss: 'When is recursion better than loops? (Tree structures, fractals, divide-and-conquer.) When is it worse? (Simple counting, when it recalculates the same values.)'
- In one sentence, tell a parent or sibling what surprised you today.
Learning objectives
- Trace recursive function calls using a visual call stack
- Compare the efficiency of recursive versus iterative solutions
- Apply recursion to design algorithms for tree-structured problems
Safety and evidence note
Read the full activity before beginning. An adult should supervise tools, heat, food, outdoor work, movement, and experiments as appropriate. Completion records that the activity was done; the child’s explanation, work sample, photo, or demonstration is stronger evidence of learning than a completion check alone.
Related coding activities
AI Explorers
Train a pretend 'robot brain'! Show it 5 cat pictures and 5 dog pictures, then test if it can guess a new one.
Algorithm Art
Follow step-by-step drawing instructions to create a picture. The instructions are your algorithm! Each step adds one shape or line.
API Restaurant
Play restaurant! The customer tells the waiter what they want, the waiter tells the kitchen, and the kitchen makes it. The waiter is the messenger — just like how computers talk to each other!
App Design Workshop
Design your dream app! Draw what you'd see on a phone screen. What would your app do? What buttons would it have?