In an earlier post (here), I talked about a way to calculate a run of 4 double factorials (n, n+2, n+4, n+6) quickly.

**((n * n+6) + 4) ^{2} – 16**

Turns out — there’s another way, too.

That number which is squared? If you’re starting with n=1, it follows a pattern.

11 + (**0** * 128) = 11 * 11 = 121 -16 = 105 = 1 * 3 * 5 * 7

11 + (**1** * 128) = 139 * 139 = 19321 – 16 = 19305 = 9 * 11 * 13 * 15

11 + (**3** * 128) = 395 * 395 = 156025 – 16 = 156009 = 17 * 19 * 21 * 23

11 + (**6** * 128) = 779 * 779 = 606841 – 16 = 606825 = 25 * 27 * 29 * 31

11 + (**10** * 128) = 1291 * 1291 = 1666681 – 16 = 1666665 = 33 * 35 * 37 * 39

And so on.

0, 1, 3, 6, 10, 15, 21, 28, 36 — a pattern you can get by starting with 0, then adding 1, then 2, then 3, then 4, etc. Also known as the Triangular Number sequence.

The ultimate reason I’m interested in double factorials is because they can be used to crack a semiprime.

In principle, you ‘d simply do this:

1. Calculate the (odd) double factorial of the square root of a semiprime (*p*). Let’s call that *d*.

2. *d* mod *p* = *b*.

3. Highest common factor of *b* and *p* = one of the prime factors of *p*.

So — am I any closer to cracking semi-primes?

Not yet. But I’m definitely having fun along the way.