A Dudeney Numbers is a positive integer that is a perfect cube such that the sum of its decimal digits is equal to the cube root of the number. There are only six Dudeney Numbers and those are very easy to find with CP.
I made my first experience with google cp solver so find these numbers (model below) and must say that I found it very convenient to build CP models in python!
When you take a close look at the line: solver.Add(sum([10**(n-i-1)*x[i] for i in range(n)]) == nb)
It is difficult to argue that it is very far from dedicated optimization languages!
from constraint_solver import pywrapcp
solver = pywrapcp.Solver('Dudeney')
x = [solver.IntVar(range(10),'x'+str(i)) for i in range(n)]
nb = solver.IntVar(range(1,10**n),'nb')
s = solver.IntVar(range(1,9*n+1),'s')
solver.Add(nb == s*s*s)
solver.Add(sum([10**(n-i-1)*x[i] for i in range(n)]) == nb)
solver.Add(sum([x[i] for i in range(n)]) == s)
solution = solver.Assignment()
collector = solver.AllSolutionCollector(solution)
for i in range(collector.solution_count()):
current = collector.solution(i)
nbsol = current.Value(nb)
if __name__ == '__main__':