A fast algorithm for determining the k-error linear complexity profile of a q-ary sequence with a period pn