Something similar can be found at Project Euler, http://projecteuler.net/ or at Codewars, http://www.codewars.com/, although those have a stricter format than your examples. For example, the challenges at Project Euler all have a single number as answer. Some problems can thus be solved via mathematics, but for most a program -- you may pick the language -- is most efficient.