How to make Keygens for Programs?

Cryptography, decoding, encoding, learning to create keygens for programs is easy. Let us assume that we have a program that you want to "try". This program needs a key that has 16 numbers, each one 0 to 9.
Let us assume that we have a program that you want to "try". This program needs a key that has 16 numbers, each one 0 to 9. You also need to acquire a small amount of keys and generate the formula based on those. However, say we have the following:

9336-0002-5196-9025's seemingly impossible to see any pattern in that. The people who make programs try to make it hard to guess which ones are valid and which ones aren't.

However, when you put the key into the program, it somehow knows if the key is valid or not. What the program is doing is checking a predetermined formula to see if the key fulfills the formula.

Now, here's where the hackers are clever. Instead of just trying to figure out the formula by guessing, they open the program up (disassemble it) and look at what it's told to do when it's given a key. That is the formula that is needed. They take that formula, and write a program of their own that makes keys so that formula is fulfilled.

If the hackers coded the keygen right, then any code that it generates will pass the formula, so any key will be valid.

For instance, trying to guess what codes are valid is hard. But if you open up the program and see the following:

Check if digit4 is double that of digit2, and ignore anything above the ones column. eg. 4 -> 8, 7 -> 4
Check if digits 5-8, as a single number, are prime.
Check if digit9+digit10 are equal to digit12.
Check if digit13 is the same as digit1.
Check if the last digit is odd.

...then you can just make a program that makes your own number with those restrictions, and any key that followed those rules would be valid.

[By the way, all the above keys fulfill the criteria.]

There are other factors, such as a lot of software checking online to see if the key is valid, but those are more along the lines of circumvention and not the actual keygen process.

This is also why some keygens have a "signature" in the key. For instance, a lot of Razor1911's keys have a RAZR or 1911 in them. If they were to crack my program, an example key that would be generated would be: