CPS factorial calculation