What Is the Next Best Ingredient to Add?
If you assume a 3NF design in the entity relationship diagram below:



Recipes are stored in a Recipe table, a recipe's ingredients are stored in  RecipeIngredients table, and the MyIngredients table contains an entry for each ingredient on hand.

Your Next Best Ingredient(s) is found with the following query:


SELECT Ingredients.IngredientID 
  , Ingredients.IngredientName
  , count() RecipesCompleted
FROM Ingredients 
 INNER JOIN RecipeIngredients on Ingredients.IngredientID = RecipeIngredients.IngredientID
 INNER JOIN (
   SELECT RecipeID
     , count() RemainingIngredients
   FROM Recipes
     INNER JOIN RecipeIngredients on Recipes.RecipeID = RecipeIngredients.IngredientID
     LEFT JOIN MyIngredients on RecipeIngredients.IngredientID = MyIngredients.IngredientID
   WHERE MyIngredients.IngredientID is null
   GROUP BY RecipeID
   HAVING count(*) = 1) RecipesWOneIngLeft 
      on RecipeIngredients.RecipeID = RecipesWOneIngLeft.RecipeID
 LEFT JOIN MyIngredients on RecipIngredients.IngredientID = MyIngredients.IngredientID
WHERE MyIngredients.IngredientID is null
GROUP BY Ingredients.IngredientID
 , Ingredients.IngredientName
ORDER BY RecipesCompleted DESC 


Let's break the query down a bit.  It works using the following theories:


By inserting your ingredients into the MyIngredients table allows, you're allowed to have N ingredients.
The next step is to use your algorithm to identify all recipes which are missing just one ingredient.  This is done in the RecipesWOneIngLeft sub-query
The final step counts the number of recipes which are completed by each ingredient and then orders the result so the NBI is first.   




Consider rewording your plain english algorithm to the following:

When user searches N ingredients, isolate ALL remaining recipes such that there is 1 (and only 1) vacant slot for an “unsearched” ingredient. Tally up the frequency of all “unsearched” ingredients. Whichever “unsearched” ingredient has the highest frequency becomes the NEXT BEST INGREDIENT.