fcn j2(n,k,m){ reg p=[0..n-1].walk().copy(), i=0, seq=L(); while(p.len()>m){ i=(i+k-1)%p.len(); seq.append(p.pop(i)); } "Prisoner killing order: %s.\nSurvivors: [%s]" .fmt(seq.concat(","),p.concat(",")) }