I am making a Skyrim potion program in emacs lisp. The program will take a list of ingredients and returns a list of potions that can be created from the ingredients. However, I am having issues in finding a formula that explains what dictates if a potion can be created from ingredient A and ingredient B. I've thought of simply hard-coding all the possible recipes, however I believe there are (factorial(num_of_ingredients))/3 possibilities; give or take a few. That is a very, very large number.
Can anyone help me out with this? To reiterate: what is the formula that determines if ingredient a b and c and be combined to create potion d.