Quantum Algorithms for Clustering and Covert Factoring