it's a simplest way just memorise this formula bcz you can find any partition fxn from this approach.in your exam you will get many questions from the same approach.
do remember the formula of grand partition function... this will help you in examss.... the formulas that u find in question ,in theory, write them separately and make a shortnotes...