lucky_number solve but not optimisied