Archive for the ‘Prime Factorization’ Category

Mathematical Colors and Codes, Episode Two: Prime Factorization Codes

Thursday, July 2nd, 2020

Episode Two of my Mathematical Virtual Program Series is up!

In Episode Two, I talk more about prime factorization and ways to show it with colors. Then I show how you can use that idea to make a prime factorization code.

This video has a downloadable coloring page to help you make your own prime factorization code.

Here’s this week’s video:

Here are links to the entire Mathematical Colors and Codes series:

Episode One, Prime Factorization
Episode Two, Prime Factorization Code

Mathematical Colors and Codes

Monday, June 22nd, 2020

My Mathematical Virtual Program Series is up!

This program is a series of six videos with downloadable coloring pages. New videos will post on Mondays at 3 pm.

They will show kids how to use math to make colorful patterns and coded messages, learning about prime factorization and nondecimal bases along the way.

They’ll post on Fairfax County Public Library’s website, but I’ll post them here as well.

These will be best for kids who already understand multiplication.

And this week, Episode One is up! It covers Prime Factorization, with an explanation of my Prime Factorization Sweater. And it explains how you can color your own chart, using this downloadable coloring page.

I hope you enjoy it!

Here are links to the entire Mathematical Colors and Codes series:

Episode One, Prime Factorization
Episode Two, Prime Factorization Code

Normal Distribution Scarf

Friday, August 12th, 2016

Today I finished a second Normal Distribution Scarf.


The first one I made was designed to highlight outliers to show that outliers are what makes the world beautiful.

For this one, I only wanted to show the Normal Distribution. I decided to knit it the long way so this time I wouldn’t have to sew any ends in.

I took colors from light to dark, in shades of pink. Colors B and C were a little closer than I wanted them to be, but it still gave the idea.


I generated numbers from a normal distribution and made a big list. For positive values, I purled the row, and for negative values, I knitted — so those values should be about even, making random ridges.

For the color, I used the absolute value, from light to dark. Since the normal distribution is a bell curve, there should be many more values in the lighter colors.

For 0 to 0.5, I used White.
0.5 to 1.0 was Victorian Pink.
1.0 to 1.5 was Blooming Fuchsia (only a little darker than Victorian Pink).
1.5 to 2.0 was Lotus Pink — a bright, hot pink.
Above 2.0 was Fuchsia — a dark burgundy.


Naturally, I used a lot more of the lighter colors. So for my next project after my current one, I think I’m going to do another normal distribution scarf, but this time reversing the values. So the new scarf would be mainly dark colors with light highlights.

In fact, if I weren’t using pink (maybe purple or blue), it would be fun to make scarves for a couple this way. Use dark, staid, sedate colors for the man, with light highlights. Use pastel shades for the woman — with dark highlights. [Hmmm. If I knit a scarf for a boyfriend before he exists, would the boyfriend jinx not apply?]


In this version, the lighter colors were more prominent.

Here’s a view of the scarf draped over my couch, showing both sides.


The different look has to do with where the knits and purls were placed and which side has a ridge and which is smooth.

Here’s a closer look:


I like the way the color combinations turned out so pleasing.


The only real problem is that the scarf is made out of wool, and it was almost 100 degrees outside today. So for now, I’m going to have to enjoy it draped over my couch rather than wearing it. I’ll look forward to this winter!


Update: I made an opposite scarf to this one, also generating random numbers and using the same exact yarn, but going from dark to light. Together, they make a matched set, so I gave them to my daughter and her wife-to-be!

Prime Factorization Coloring Sheets

Wednesday, April 27th, 2016

I’ve posted several Prime Factorization Coloring Sheets on my Sonderknitting page lately.

I decided I should try coloring them myself, so I could post a thumbnail of each one. I had a lot of fun doing it, and was reminded of lots of cool properties I discovered from knitting my prime factorization sweater and looking at these charts.

I have a manuscript for a math-related children’s nonfiction book about using math to make codes with colors. Originally, I put several of these charts into the book — but I eventually decided it was a distraction and decided to put them on my website instead.

But they show all sorts of cool things!

First, there’s the ten-by-ten prime factorization chart using ordinary, decimal numbers.


Coloring this chart gives you a great feeling for factorization and multiples. I posted about watching a second grader color it. I think of it as more for older kids, who are learning about primes and multiples, or indeed adults, in keeping with the adult coloring book craze. But watching a second grader color it assured me that it can give insights to anyone. (I made the instructions such that you don’t even have to know how to multiply. Just color every second square the color for 2, every third square the color for 3, and so on.)

Now, in my original sweater, I put rows of 8 on the back and rows of 2 and rows of 3 on the sleeves. The prime factorization charts in different bases are the same idea.

First, they give you a feeling for how different bases work.

Here’s the sheet for octal, base 8:


You can color it exactly the same way as you did the ten-by-ten chart. Color every second square with the color for 2, every third with the color for 3, and so on. If you take the time to do that, you’ll grasp how the numbers count up to 7 and then use the next digit, since place value in octal gives the ones digit, the eights digit, and the sixty-fours digit.

The chart also makes a good way to translate between octal and decimal. (Though you can just multiply the eights digit times eight and add the ones digit.)

But I enjoy some of the other patterns.

The first, most obvious pattern is that in the decimal chart, the multiples of 5 and the multiples of 2 line up vertically (as well as the multiples of 10, which are both). That’s because 10 = 2 x 5.

In the octal chart, the multiples of 2 line up vertically, since 8 = 2 x 2 x 2. So do the multiples of 4 — each with two factors of 2, and the multiples of 8 — each with three factors of 2.

In the Base 6 chart, as you’d expect, the multiples of 2 and the multiples of 3 line up vertically. (And the multiples of 6, with a factor of 2 and a factor of 3, do as well.)


But it’s also fun what happens to the color for Base Plus One and Base Minus One.

In the 10×10 chart, look at what happens to the color for 11, orange, and the multiples of 11. They go diagonally to the right up the chart: 11, 22, 33, 44, . . .

In the 10×10 chart, 9 is represented by two sections of blue, for 3 x 3. These colors go diagonally up the chart in the opposite direction: 9, 18, 27, 36, . . .

In the 8×8 chart, the octal number 11 is the decimal number 9 — so it is still represented by two sections of blue. But since 9 is one bigger than our base in that chart, the two sections of blue go diagonally up the chart to the right — just like 11 in the decimal chart.

In the octal chart, the color for 7, purple, goes diagonally up the chart to the left, with the octal numbers 7, 16, 25, 34, . . . .

In the 6×6 chart, we’ve got the same patterns, this time with 7 (which is 11 in base six) and 5.

7 (purple) goes diagonally right up the chart, and 5 goes diagonally left up the chart.

And we’ve got the same patterns in a 7×7 Base Seven chart:


Notice that since 7 is prime, no colors line up except purple, the color for 7.

And the colors for 8 and 6 go diagonally up the chart.

The Hexadecimal chart in base 16 is even more interesting:


Notice how all the multiples of 2 line up vertically, with multiples of 4, 8, and 16 also lined up.

11 in Base 16 is decimal 17, which is brown, and it acts like all the other 11s, going diagonally up and to the right.

1 less than 16 is F = 15, and the blue and green colors for F go diagonally up and to the left.

Before I finish I want to mention one more pattern I noticed from looking at these charts. It’s the familiar trick in Base 10 of the rule for figuring out if any number is a multiple of 9: Just add up the digits, and they will be a multiple of 9.

The reason this works is that 10 is congruent to 1 mod 9.
In base 10, each decimal place represents a number multiplied by a power of 10.
In base 9, that’s going to be the same as multiplying by 1 — so if you add up the digits, you get what the number is congruent to mod 9.

If none of that made any sense to you, just know this:
If you add up the digits of a base 10 number (and if you get a number bigger than 9, add them up again), your result is the remainder you’ll get if you divide the number by 9.

Since multiples of 9 have no remainder when divided by 9 — the digits of multiples of 9 in base 10 always add up to multiples of 9. (And by the same reasoning, the digits of multiples of 3 in base 10 always add up to multiples of 3.)

But you might have noticed when looking at the diagonal colors:

In Base 8, the digits of multiples of 7 always add up to multiples of 7.

In Base 6, the digits of multiples of 5 always add up to multiples of 5.

In Base 7, the digits of multiples of 6 always add up to multiples of 6.
And the digits of multiples of 2 always add up to multiples of 2.
And the digits of multiples of 3 always add up to multiples of 3.
(Use the colors to tell which numbers these are in Base 7.)

In Base 16, the digits of multiples of F (15) always add up to multiples of F.
And the digits of multiples of 5 always add up to multiples of 5.
And the digits of multiples of 3 always add up to multiples of 3.
(Use the colors to tell which numbers these are in Base 16.)

Forgive me, but I think these patterns are Awesome!

Let’s face it, you’ll see them much more clearly if you color the charts yourself!

Download the coloring charts at Sonderknitting!

Happy Coloring!

Coloring to Learn Math Concepts!

Saturday, January 30th, 2016


I’m super excited about something I’ve been working on lately — posting Mathematical Coloring Sheets on my Sonderknitting webpage.

Why Sonderknitting? Because the ideas in the coloring pages come from my mathematical knitting projects, which all began with my Prime Factorization Sweater.

PF Sweater

I wore the sweater to the library today, for our Family Math Games event. (We have lots of board games and card games that build math skills and ask only that parents play with their kids.) I also printed out some copies of the Prime Factorization Coloring Sheet — the one that matches my sweater — and brought some crayons.

A girl named Ana who is a regular at our Crazy 8s Math Club was there. She got tired of playing games with her little brother, and her Mom showed Ana the coloring sheet, and Ana became the first actual child to color one!


I explained the idea to Ana, using my sweater as a visual aid.

There are different ways you can approach it, but what I suggested was to choose a color for 2, then color a section of every second number. Then choose a color for 3 and color a section of every third number. Then I had to explain you use the color for 2 again to color a second section in the square for 4, then give every 4th number a second section of the color for 2. Then you choose a new color for 5, and she quickly caught on that all the multiples of 5 were in columns….


I can’t tell you how happy it made me to hear what she’d say as she was understanding how to do it (“Oh, I see!”) and seeing the patterns come out.

I think Ana’s in 2nd grade (Crazy 8s is for Kindergarten to 2nd grade.), so she can’t have studied much multiplication in school yet. So it made me all the happier to see the wheels turning and the connections forming.

But my favorite thing she said? “I like this! This is fun!”


Zoe’s Prime Factorization Blanket!

Saturday, January 16th, 2016

Back in November, I finished my little niece Zoe’s Prime Factorization Blanket!


What is a Prime Factorization Blanket? Why, a blanket that shows the prime factorization of all the whole numbers up to 99, using a color for each prime number.

This is the same set-up as my niece Arianna’s Prime Factorization Blanket, as a matter of fact. But I used new colors for Zoe’s blanket, going with a lot of pink, because we already knew she was going to be a girl. (With Arianna, we found out she’d be a girl right when I got to the number 17, so in that blanket 17 is pink.)

The blankets don’t really need a pattern, but here are the specifications: I used Tahki Cotton Classic yarn, because it has so many shades available. Each square is a garter stitch square with 12 ridges and 12 stitches, which is easy to divide in 2, 3, 4, or 6 sections. For 5 sections, I did a plain row at the beginning and end. It’s done in entrelac, so you go across and knit the square for each number individually, then go back making the white squares, then do the next row of numbers, then a row of white. It’s much nicer than making the original sweater, because you can work on one number at a time, and don’t have to carry yarn across.

Here is Zoe’s Prime Factorization Blanket laid out flat (or sort of flat):

Zoes Blanket

Here’s how it works. Starting in the bottom left corner (because graphs always have the origin in the bottom left), there’s a missing space for zero. Then 1 is pale pink, the background color:

Zoes Blanket bottom left

2 was assigned the color pink.
3 was assigned the color red.

Zoes Blanket bottom middle

4 is our first composite number, 2 x 2. So I used two sections of pink. (If you look at the actual blanket, you can tell there are two sections, but it’s harder to tell in the picture.)
5 is prime, so it’s assigned a new color, yellow.
6 is composite, 2 x 3. So it gets a section of pink and a section of red.

Zoes Blanket bottom right

7 is prime, so it gets a new color, purple.
8 is composite, 2 x 2 x 2. Three sections of pink.
9 = 3 x 3, so it gets two sections of red.

New row, so look back at the photo of the bottom right.
10 = 2 x 5, so it gets a section of pink and a section of yellow.
11 is prime, so it gets a new color, turquoise.
12 = 2 x 2 x 3, so two sections of pink and one section of red.
13 is prime, so it gets a new color, sea foam green.

Now the picture for the middle:
14 = 2 x 7, so pink and purple.
15 = 3 x 5, so red and yellow.
16 = 2 x 2 x 2 x 2, so four sections of pink.

Now the picture of the right side:
17 is prime, so it gets a new color, baby blue.
18 = 2 x 3 x 3, one section of pink, two sections of red.
19 is prime, so it gets a new color, olive green.

The next row starts at 20. The blanket goes all the way up to 99.

Here’s the top corner, so you can see some bigger numbers:

Zoes Blanket top corner

You can see the patterns nicely in the grid of the blankets. As an example of some simple patterns, the twos and fives line up in straight lines, but so do the elevens, in a diagonal line. There are lots more patterns which you can find the more you look at the blanket.

And Zoe likes it!


I’m gathering all my Mathematical Knitting links on my Sonderknitting page. (I hope to soon add coloring pages, too!) Check out the rest!

My Prime Factorization Hairnet

Wednesday, October 14th, 2015


Our church is having a Stop Hunger Now Food Packaging Event next Sunday, October 18, 2015. As a form of publicity for the event, they’ve asked us to decorate a hairnet and take a selfie.

That was the moment I realized: I have a Prime Factorization Sweater, a Prime Factorization Cardigan, a Prime Factorization Scarf, a Prime Factorization T-Shirt, and have made Prime Factorization Blankets. But I didn’t have a Prime Factorization Hairnet!

Well, I soon remedied that!


Okay, it’s not knitting. But I printed a chart I’d made of numbers color-coded with their prime factorization for the Prime Factorization T-shirt. Then I simply cut out the individual squares and glued them to the hairnet in a spiral pattern. So it goes from 1 to 100.

How it works? Each prime number gets a new color. Composite numbers are divided into sections with a section for each factor. Each section is colored according to that prime’s color. For example, 42 = 2 x 3 x 7, so the square for 42 is divided into three sections, colored blue for 2, red for 3, and green for 7.

This selfie not only shows the Prime Factorization Hairnet, it also gives a glimpse of infinity!


Oh, and I’m gathering all my Mathematical Knitting (and other mathematical creations) at Sonderknitting. Eventually, I’ll add mathematical explanations and patterns and activities and other good things.

I can safely say that mine is the most educational hairnet selfie posted yet!

Pascal’s Triangle Shawl #2

Tuesday, May 19th, 2015

Hooray! Hooray! Today I finished my second, prettier Pascal’s Triangle Shawl!


Pascal’s Triangle is the triangle with 1s on the edges, where each entry is the sum of the two entries above it.

So the beginning rows work like this:

1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1


Now, what I did was choose a color of yarn for each prime. Then each entry in the triangle is factored, and each number is shown by the colors of its factors.

I did the same thing with my first Pascal’s Triangle Shawl. With this one, since there are only the primes 2, 3, 5, 7, 11, and 13, I decided to use progressively darker shades of pink and purple, so the shawl would gradually get darker.

Here is a closer look at a section of the shawl:

Right Side

This next picture shows that along the second row, we have the numbers simply in sequence.

Right and Top

For math nuts, each row also contains the binomial coefficients, the coefficients in the expansion of

This means that the rth entry in the nth row can be calculated with the formula:
n!/(n-r)! (Counting the entries in each row as 0 through n.)

Some examples: The 2nd entry in the 5th row is (5×4)/(2×1) = 10

The 3rd entry in the 7th row is (7x6x5)/(3x2x1) = 35

Now, I factor all the numbers in my shawl, so for big numbers, it doesn’t matter what the actual number is, but the factorization is easy from the formula.

For example, the 4th entry in the 15th row is (15x14x13x12)/(4x3x2x1) = 3x5x7x13

You can see some of the bigger numbers in this picture:

Right Factored

Now, there are a couple of characteristics which I believe make the shawl especially beautiful.

One is that because these are the binomial coefficients, once you get to the row of a prime number, every entry in that row has the prime for a factor.

This is easier to see with the actual shawl in front of you, but here again is the big picture. You can see that once a new color starts, it goes all the way across the row.


What’s more, by the distributive law, since every entry in a prime row has that prime as a factor, all the sums of those numbers will also have the prime for a factor — and we end up having inverse triangles of each color.

Here’s some more detail:



Of course, the very coolest thing about it is that, even if you have no idea of the math involved, the combination is beautiful.

And that simply makes me happy.

Modeling Shawl

My posts on Mathematical Knitting and related topics are now gathered at Sonderknitting.

Oops! Can you find the mistake?

Monday, November 3rd, 2014

Wearing cardigan1

Oops! Today I realized I had used the wrong shade in one of the rows of my prime factorization cardigan. I remembered I had discovered that in the process of knitting, and had planned to go over the offending line with duplicate stitch. But I forgot — so now I think I will use it as a puzzle. Can you spot the number that is out of place?

You’ll definitely need a closer look at the cardigan.

Who will be the first person to spot the error? (You can use the comments to inform me.) This person is almost as geeky as me! 🙂 Though at least I can restrain myself from taking apart the cardigan. There was an error in my Prime Factorization Sweater — but it was one of five factors of a number (probably 72), so it only involved four stitches in the wrong color. I was able to pick them out, then reinsert the right color with a yarn needle.

Oh, I should say that the error is not in row 48, which is 2 x 2 x 2 x 2 x 3. I didn’t want to have the pink thread loose over all four blue stitches, so I twisted the yarn after two stitches — and it ended up showing up a bit on the front, though not as much as an actual wrong stitch.

No, the error is a matter of using the wrong shade in one of the stripes. The result would be far too large a number for this sweater. And now I can use it to find out who is paying attention. 🙂

My posts on Mathematical Knitting and related topics are now gathered at Sonderknitting.

My Prime Factorization Cardigan

Monday, November 3rd, 2014

I did it! More than two years after beginning, I have finally completed my Prime Factorization Cardigan!

Wearing cardigan1

Here’s how it works! The stripes each represent a counting number. They go from left to right, cuff to cuff. 1 is black, the background color (which is a factor of everything). Then each prime gets a new color. 2 is blue; 3 is pink; 5 is yellow; 7 is purple….

Composite numbers get the combination of colors for their factors. 6 = 2 x 3, so it’s alternating blue and pink. 10 = 2 x 5, so blue and yellow. 12 = 2 x 2 x 3, so two stitches of blue followed by one of pink….

Perfect powers get multiple rows. 4 = 2 x 2, so two rows of blue; 8 = 2 x 2 x 2, so three rows of blue; 9 = 3 x 3, so two rows of pink. I think my favorite is 36 = 2 x 2 x 3 x 3, so I did two rows of alternating blue and pink.

I put labels in one picture, to give the pattern:

Labeled Cardigan1-18

As for details, I used Plymouth Encore yarn, 75% acrylic, 25% wool — it is not expensive and comes in many colors. I looked online for a pattern knitted cuff-to-cuff, and found this Rainbow Lace Jacket. I of course changed the colors. I knitted the stripes in garter stitch, and the rows in between the stripes in black stockinette.

And now for more pictures! First, an overall look at the sweater again:

PF Cardigan Front

And with the arms down:

PF Cardigan arms down

And the back: (I decided to make the numbers go two-dimensionally across the sweater, from cuff to cuff. So the back is a mirror of the front.)

PF Cardigan Back

And here’s more detail, Numbers 17 to 32 (The powers of 2 are easy to spot! They are the multiple rows of blue.):


Then Numbers 26 to 38:


34 to 47:


41 to 58:


51 to 63:


And finally, 64 to 78:


There you have it! The latest in my prime factorization knitting adventures. Let’s see, I feel compelled to summarize what I’ve done.

It began with the Prime Factorization Sweater.


Then when that became wildly popular on the internet, I made a Prime Factorization T-shirt. (These are available for sale, by the way.)

Twitter Profile

I experimented with stripes when I made my Prime Factorization Scarf, and planned out how to do this cardigan.

Prime Factorization Scarf

Then my siblings were expecting babies. For my sister’s baby, I knitted a Coded Blessing Blanket.

Blessing Blanket

For my brother’s baby, nothing but a Prime Factorization Blanket would do.


Which got me going on a Pascal’s Triangle Shawl.


Which got me to start another, prettier one (Still not finished).

Pascals Colors

And brings me back to the Prime Factorization Cardigan!

Wearing cardigan hands down

My posts on Mathematical Knitting and related topics are now gathered at Sonderknitting.