Elixir translation of the Python code in Think Complexity by Allen B. Downey