Advent of Code

   var y=2016;

--- Day 19: An Elephant Named Joseph ---

The Elves contact you over a highly secure emergency channel. Back at the North Pole, the Elves are busy misunderstanding White Elephant parties.

Each Elf brings a present. They all sit in a circle, numbered starting with position 1. Then, starting with the first Elf, they take turns stealing all the presents from the Elf to their left. An Elf with no presents is removed from the circle and does not take turns.

For example, with five Elves (numbered 1 to 5):

5   2
 4 3

So, with five Elves, the Elf that sits starting in position 3 gets all the presents.

With the number of Elves given in your puzzle input, which Elf gets all the presents?

To play, please identify yourself via one of these services:

[GitHub] [Google] [Twitter] [Reddit]

(Twitter users: if you have auth problems that claim "There is no request token for this page", please clear your cookies and try again.)