A fast algorithm for the construction of recurrence relations for modified moments