Jane Street Interview Question

The first was a basic number theory puzzle. The second was a simple probability problem, with increasingly trickier questions.