Iteration generation instead of optimization

Python:

CrossRef: