Random K-satisfiability: from an analytic solution to a newefficient algorithm