Pregunta de entrevista de Google

A simple mathy question, and a simple algorithm question