In this chapter I used the following external libraries.
import Base.Iterators.takewhile as takewhile
import BenchmarkTools as Bt # external library
Those were used only for the chapter’s extras and are not strictly necessary to solve the task.
Anyway, I recommend you try to solve the task on your own first. Once you finish you may compare your own solution with the one in this chapter (with explanations) or with the code snippets (without explanations).