Viridien interview question

several math problems, plus PHP and MySQL coding