n = 41 k = 3 print "prisoners: " & n print "step size: " & k for i = 1 to n lm = (lm + k) mod i . print "final survivor: " & lm