Factoring an integer with three oscillators and a qubit