Jane Street Interview Question

Some math Olympic questions, seems like not much knowledge needed.