Pattern Programmers Slides Math + Logic
Pattern Programmers
Mastering math through the logic of code. Five challenges to test your pattern-finding skills.
BINARY
LOOPS
LOGIC
What is Coding?
Coding isn't just about computers. It is a way of giving precise instructions to solve a problem.
The Programmer's Secret
"Computers don't think. They follow patterns."
Algorithms
A step-by-step set of operations to be performed.
Iteration
Repeating a process to generate a sequence.
CHALLENGE 01
The Binary Bead Pattern
0
1
Base-2 Mathematics
How do computers represent numbers using only two digits? You will decode numerical patterns and turn them into physical bead designs.
Math Skill
Place Value
Coding Skill
Data Representation
Pattern
Base-2 Sequences
CHALLENGE 02
Coordinate Commands
Use ordered pairs \((x, y)\) as code to move a "pen" across a grid. Create complex geometric patterns using only numerical coordinates.
MOVE_TO(3, 5);
LINE_TO(7, 5);
LINE_TO(5, 9);
CLOSE_PATH();
CHALLENGE 03
Nested Loop Mandalas
What is a Loop?
A command that tells the computer to repeat an action multiple times.
Nested?
A loop inside another loop! This creates complex, symmetrical beauty.
CHALLENGE 04
Logic Gate Colorizing
The Power of IF
Coding often involves making choices.
IF (number is Even)
COLOR = Blue;
ELSE
COLOR = Red;
CHALLENGE 05
The Golden Ratio Script
1, 1, 2, 3, 5, 8, 13, 21...
"The universe's favorite algorithm."
Discover how nature codes itself. You will write a pseudo-code script to generate the Fibonacci sequence and visualize it as a shell pattern.
Ready to Program?
01
Binary
02
Grid
03
Loops
04
Logic
05
Growth
CHOOSE YOUR FIRST MODULE >_
Binary Bead Worksheet Binary Bead Pattern
Module 01: Data Representation
Name:
Date:
Mission: Computers talk using only 1s and 0s. This is called Binary. In this challenge, you will decode numbers using place value and turn them into a pattern for a "Binary Bracelet."
The Binary Rulebook
16s Place
16
8s Place
8
4s Place
4
2s Place
2
1s Place
1
Example: The number 13
To make 13, we need an 8, a 4, and a 1. (\(8 + 4 + 1 = 13\))
0
1
1
0
1
Coding Challenges
Determine the binary code for each decimal number, then fill in the bead pattern (Black circle = 1, White circle = 0).
Challenge A
9
Challenge B
22
Challenge C
31
Final Code String:
Combine all three of your bead patterns (A + B + C) to create a repeating 15-bead sequence below.
Coordinate Grid Worksheet Coordinate Commands
Module 02: Vector Graphics & Geometry
Name:
Date:
Mission: Use vector logic to draw. In coding, images are often created by telling a "turtle" or a pen exactly where to move on an X and Y axis.
Part 1: The Compiler
Read the code below and execute the commands on the grid. Start at the first MOVE_TO position.
// Initial Square
1. MOVE_TO(2, 2);
2. LINE_TO(8, 2);
3. LINE_TO(8, 8);
4. LINE_TO(2, 8);
5. LINE_TO(2, 2);
// Nested Diamond
6. MOVE_TO(5, 2);
7. LINE_TO(8, 5);
8. LINE_TO(5, 8);
9. LINE_TO(2, 5);
10. LINE_TO(5, 2);
109876543210
012345678910
Part 2: The Architect
Create your own symmetrical pattern on the grid. Then, write the commands to "re-create" your drawing. Use at least 8 commands.
MOVE_TO(____, ____);
LINE_TO(____, ____);
LINE_TO(____, ____);
LINE_TO(____, ____);
LINE_TO(____, ____);
LINE_TO(____, ____);
LINE_TO(____, ____);
LINE_TO(____, ____);
109876543210
012345678910
Nested Loop Mandala Worksheet Loop Mandalas
Module 03: Iteration & Angles
Name:
Date:
Mission: A LOOP tells a computer to repeat something. A NESTED LOOP is a loop inside another loop. Use multiplication and angles to predict what these loops will create!
The Loop Calculator
// Outer Loop repeats 8 times
FOR rotation = 1 TO 8:
// Inner Loop repeats 3 times
FOR side = 1 TO 3:
DRAW_LINE(10cm);
TURN_RIGHT(120°);
TURN_RIGHT(45°);
1. What shape does the Inner Loop draw by itself?
2. How many total lines will the computer draw?
Calculation: (Outer Repeats) × (Inner Repeats)
3. Why is the final TURN 45°?
Hint: There are 360° in a full circle. Divide 360 by the outer loop repeats.
Part 2: Manual Loop Execution
Follow the "Manual Loop" below to create a symmetrical mandala. Use the template provided.
Your Algorithm
1. Draw a small circle in Section 1 .
2. Repeat for all 8 sections.
3. Draw a triangle in Section 1 .
4. Repeat for all 8 sections.
5. Add one unique detail in Section 1 and repeat for all.
1 2 3 4 5 6 7 8
Debugging Patterns
If you changed the Outer Loop to repeat 10 times, what would your new TURN angle need to be to complete a full 360° circle?
Logic Gate Patterns Worksheet Logic Gate Patterns
Module 04: Conditional Logic (IF/THEN)
Name:
Date:
Mission: Coding isn't just about repeating; it's about making choices. A Conditional Statement tells the computer to check a rule before doing something.
The Pattern Processor
// Conditional Pattern Rule
FOR EACH n FROM 1 TO 10:
IF (n is MULTIPLE of 3):
DRAW_TRIANGLE();
ELSE IF (n is EVEN):
DRAW_SQUARE();
ELSE:
DRAW_CIRCLE();
Apply the rule to each number box below!
n=1
n=2
n=3
n=4
n=5
n=6
n=7
n=8
n=9
n=10
Part 2: The Logic Designer
Write your own IF/THEN/ELSE rule using the numbers 1-5. Then draw the resulting pattern below.
IF (the number is ____________________________)
THEN DRAW A _____________________________
ELSE:
DRAW A _____________________________
1
2
3
4
5
Fibonacci Sequence Challenge The Fibonacci Script
Module 05: Recursion & Nature's Patterns
Name:
Date:
Mission: Explore Recursion. This is when a pattern refers back to its own previous steps. Nature uses this "script" to build shells, flowers, and galaxies!
The Growth Algorithm
The rule is simple: Add the two previous numbers together to get the next one.
0
1
=
1
0
1
1
2
3
Part 2: The Golden Spiral
Draw squares on the grid below following the Fibonacci sequence. The first three (1x1, 1x1, 2x2) are done for you. Add the next three sizes: 3x3, 5x5, and 8x8 .
2
Growth Grid [1 unit = 20px]
Part 3: The Fibonacci Code
Complete the code that a computer would use to find the next number in the sequence.
// Find next Fibonacci number
SET num1 = 5;
SET num2 = 8;
FUNCTION getNext(A, B):
SET result = ________ + ________;
PRINT result;
RETURN result;
// Execution
getNext(num1, num2);
Pattern Programmers Teacher Guide Teacher Resource
Pattern Programmers
Implementation Guide & Answer Keys
Module 01: Binary Beads
Hands-on option: Use pony beads and pipe cleaners.
Math: Base-2 place value, addition.
Logic: Binary representation (0/1).
Answer Key
Challenge A (9): 01001 (8 + 1)
Challenge B (22): 10110 (16 + 4 + 2)
Challenge C (31): 11111 (16 + 8 + 4 + 2 + 1)
Module 02: Grid Logic
Computer-based: Try "Logo" or Scratch pen blocks.
Math: Coordinate pairs (X,Y), vertices.
Logic: Execution order, vector graphics.
Answer Key
Resulting Pattern:
The code creates a square from (2,2) to (8,8) and a diamond touching midpoints of the square's edges (5,2), (8,5), (5,8), and (2,5).
Module 03: Loop Mandala
Math: Multiplication, 360° division.
Logic: Iteration, nested repetition.
Answer Key
1. Shape of inner loop: Triangle (3 sides, 120° turns)
2. Total lines: 24 (8 × 3)
3. Why 45°? 360 / 8 = 45° (Symmetry)
Reflection (10 times): 36° (360 / 10)
Module 04: Logic Gates
Math: Multiples, parity (odd/even).
Logic: Boolean (True/False), Conditionals.
Answer Key
Pattern Sequence (1-10):
1: Circle
(Else)
2: Square
(Even)
3: Triangle
(Mult of 3)
4: Square
(Even)
5: Circle
(Else)
6: Triangle
(Mult of 3)
7: Circle
(Else)
8: Square
(Even)
9: Triangle
(Mult of 3)
10: Square
(Even)
Module 05: Fibonacci
Math: Summation, sequence growth.
Logic: Recursion, function parameters.
Answer Key
Sequence: 0, 1, 1, 2, 3, 5, 8, 13
FUNCTION getNext(A, B):
SET result = A + B;