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.txt1 and ages02.txt2 to be located in the current directory.

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

Epilogue

Jari Komppa (@Sol_HSA3) animated his solution.