Janice, my sister, does a lot of knitting. A lot. And occasionally, she asks me to double-check her math.
In this case, she wanted to decrease from 152 stitches in one row, to 114 stitches in the next row, and wondered if she could knit [1 1 1 2] repeatedly (where 2 means knitting together two stitches in the previous row). She tried that and ended up with a row of 122 stitches instead of 114.
So I mathed it out: and
(the sum of stitches) should be the number in the previous row, over the difference between the previous and desired stitches, in this case , or .
Similarly, (the count of stitches) should be the desired number of stitches, over the same difference: .
So the repeating segment should have 3 entries, and should sum to 4, which could be any of: [1 1 2], [1 2 1], or [2 1 1].
Which works fine when things divide nicely, but it wasn’t long until she wanted to decrease from 148 stitches in one row, to 120 in the next (a delta of 28 stitches).
Which meant that , and .
If we take a step back, across the entire row length, should be (the number of stitches in the previous row), and should be (the desired stitches in the active row), in this case: = 148, and = 120.
Which means that the number of 2s (or, k2tog—knit 2 together) should be . The remaining () stitches should be regular knits (1s), and it becomes a matter of spreading those 28 2s out relatively evenly amongst the 1s.
However, if (if the difference is greater than the desired stitch number in the active row), we can no longer simply rely on k2togs. For example, if we have and , what we need to do is [3 4 3] (or any other permutation of those values): knit 3 together, knit 4 together, knit 3 together.
Luckily, this is easy enough to deal with:
The value of the maximum merge is the floor of the difference divided by the desired number of stitches, plus 2. In the case of and :
Which matches up with the values in [3 4 3], above. As to how many of each we need:
In our case, , the number of base merges works out to . And , the number of maximum merges, works out to . Which matches the 2 3s and the 1 4 in [3 4 3].
Now that we have , and , it’s just a matter of spreading out the (1) (4) amongst the (2) s (3s). Which is pretty easy with a bid of programming code. Something along the lines of:
const occurance = Math.floor(dest/number_of_max_merges)
const padding = dest % number_of_max_merges
const lpad = Math.floor(padding/2)
const rpad = Math.ceil(padding/2)
Then we throw a in the middle of a set of occurance s, and do that times, padding at the start and the end of the row by lpad and rpad s.
Easy as a peasy, as the kids say.
In the case of , and , that works out to: start with [1 1 1 1], repeat some permutation of [1 1 2 1] 28 times, end with [1 1 1 1].
But, since this came up more than once, I made to calculate your knitting decreases so you and future brad don’t have to think about any of this:



