Alexander Belov,
<script>
var names = ["Kurt", "Dave", "Kris", "Pat", "Steve"]
function nextPerson(a) {
return a != +a ? (a = names.indexOf(a) + 1, [a *= 2, --a].reverse())
: (a % 2 && ++a, a = (a - 2) / 2 % names.length, names[a])
};
for (var i=1; i<=30; i++) {document.write(i + " => " +nextPerson ( i )+"<br>")}
</script>