Source: http://robin.pollak.io/wizard_factoring.pdf