The World's Worst Factoring Algorithm

In order to understand The World's Worst Factoring Algorithm, you first have to understand binary multiplication.

Binary multiplication works almost identically to the traditional multiplication method that we all learned in grade school, except that it uses a base 2 number base as opposed to the more familiar base 10.

In regular decimal (base 10), we multiply numbers using place values based on powers of 10 — ones, tens, hundreds, and so on. In binary (base 2), we use place values based on powers of 2 — ones, twos, fours, eights, etc. Let's take a simple example: 11 x 13 = 143

11 x 13
Base 10

11
13
33
110
143

11 x 13
Base 2 (binary)
1011
1101
1011
00000
101100
1011000
10001111

In decimal, we can break it down like this: 143 = 100 + 40 + 3 In binary, it's the same idea — just with powers of 2: 143 = 128 + 8 + 4 + 2 + 1 When you multiply 11 (1011 in binary) by 13 (1101 in binary), you get a matrix of partial products. Each row represents a shifted version of one number, based on the binary bits of the other. When you add up the bits, you get the final product.

Another way to visualize this is by replacing with 1s with their actual numeric value.

11 x 13
Base 2 (binary) Actual Values

8021
8401
8021
00000
3208400
640168000
1280008421

Each value in the matrix contributes to the final product — but once the partial products are assembled into a grid, something more interesting begins to happen. Patterns emerge. What first appears as scattered binary reveals a structure underneath — puzzle pieces hiding in plain sight.

Each set bit in the final product doesn’t just mark a position — it represents the sum of a specific shape in the matrix. That is, the value of the bit equals the total value of the puzzle piece that formed it. These shapes are consistent, reconstructable, and as each one is placed, it helps narrow the possibilities for the next.

11 x 13
Base 2 (binary)

8021
8401
8021
00000
3208400
640168000
1280008421

11 x 13
Base 2 (binary) Puzzle Pieces

The algorithm works by identifying and placing those pieces one by one. As each piece lands, it narrows the possibilities for the next, gradually reconstructing the multiplication that created n, and ultimately revealing the original factors behind it.

11 x 13
Puzzle Piece with Implied Bits

X
X
X
X

11 x 13
p and q recovery
ppp
qqq
qX
X
qX
pqXpp

Once enough of the matrix is pieced together, the original factors — p and q — start to emerge from the pattern. For 11 x 13, that gives us: p = 1011 (which is 11) q = 1101 (which is 13) No sieving, no prime tables — simply rebuilding the structure that created the product, n in the first place.