i have the python code that generates the ulam sequence but i am not able to understand how this code works can someone please explain me the working of this code???