Implement factor base generation.