Pergunta de entrevista da empresa Siemens

one coding question some puzzles related to mathematics