Optimized recursion relation for the computation of partition functions in the superconfiguration approach