Drop links or images here to add them to the editor.

Suppose the lanternfish live forever and have unlimited food and space. Would they take over the entire ocean?

After 256 days in the example above, there would be a total of 26984457539 lanternfish!

Assignment

How many lanternfish would there be after 256 days? Determine this in the following way:

Example

In this interactive session we assume the text files ages01.txt and ages02.txt to be located in the current directory.

>>> lanternfish('ages01.txt')
26984457539
>>> lanternfish('ages02.txt')
1650309278600

Epilogue

Jari Komppa (@Sol_HSA) animated his solution.