About building a list until it meets conditions
问题 I wanted to solve "the giant cat army riddle" by Dan Finkel using Prolog. Basically you start with [0] , then you build this list by using one of three operations: adding 5 , adding 7 , or taking sqrt . You successfully complete the game when you have managed to build a list such that 2 , 10 and 14 appear on the list, in that order, and there can be other numbers between them. The rules also require that all the elements are distinct, they're all <=60 and are all only integers. For example,