question is attached as an image.please ensure that code run correctly and gives you an output.Thanks!you can use sage library
2
Optional: approximate GCD problem: GCD attack and lattice attack
The Partial Approximate Common Divisor problem consists in recovering p, given o = p : qo and polynomially many x; = p qi + ri.
1. Implement the brute force attack on the noise 2. Implement the improved attack from [3]. 3. Implement the lattice attack 4. Compare the practical complexities of these attacks.