Project Euler Lab - Problem 399

#399 - Squarefree Fibonacci Numbers

● AdvancedOfficial difficulty: 45%DivisibilityTier C - reduced scale in browser; full scale in notebookNot viewed
↖ Euler Lab

The first \(15\) Fibonacci numbers are:
\(1,1,2,3,5,8,13,21,34,55,89,144,233,377,610\).
It can be seen that \(8\) and \(144\) are not squarefree: \(8\) is divisible by \(4\) and \(144\) is divisible by \(4\) and by \(9\).
So the first \(13\) squarefree Fibonacci numbers are:
\(1,1,2,3,5,13,21,34,55,89,233,377\) and \(610\).

The \(200\)th squarefree Fibonacci number is: \(971183874599339129547649988289594072811608739584170445\).
The last sixteen digits of this number are: \(1608739584170445\) and in scientific notation this number can be written as \(9.7\mathrm e53\).

Find the \(100\,000\,000\)th squarefree Fibonacci number.
Give as your answer its last sixteen digits followed by a comma followed by the number in scientific notation (rounded to one digit after the decimal point).
For the \(200\)th squarefree number the answer would have been: 1608739584170445,9.7e53

Note:
For this problem, assume that for every prime \(p\), the first fibonacci number divisible by \(p\) is not divisible by \(p^2\) (this is part of Wall's conjecture). This has been verified for primes \(\le 3 \cdot 10^{15}\), but has not been proven in general.
If it happens that the conjecture is false, then the accepted answer to this problem isn't guaranteed to be the \(100\,000\,000\)th squarefree Fibonacci number, rather it represents only a lower bound for that number.

This problem is taken from Project Euler, Problem 399.
Problem text © Project Euler, licensed under CC BY-NC-SA 4.0. Original: projecteuler.net/problem=399. Published Sunday, 21st October 2012, 11:00 am. Solved by 690 members at time of mirroring.

Why this is useful

Numerical Computing. Precision, conditioning, and numerical iteration transfer directly to pricing engines and model calibration (Phases 5, 13, 15).

We classify relevance honestly - not every Euler problem is a trading application.

Learning mode

Pick how much scaffolding you want. Your choice is remembered per problem.

Scratchpad

Mathematical notes, formulas, pseudocode, hypotheses, complexity notes. Saved automatically with your progress.

Python workbench

Tier C - reduced scale in browser; full scale in notebook
Browser runs a reduced, clearly-labelled educational scale; the original scale is provided in a local notebook.

Real Python (Pyodide) in a sandboxed Web Worker - no network, no filesystem, no DOM access. Ctrl/Cmd+Enter runs. Escape leaves the editor. Stop terminates the worker.

Python runtime not loaded (it boots on first run - a one-time local load).

Check your answer

Answers are checked against a salted hash held in a separate file - not printed in this page. This prevents accidental spoilers; it is not cryptographic protection (see the build notes).

Progressive hints

Confidence

Low confidence schedules this problem for spaced review, even if you solved it.

Reference solution

Spoiler
The complete original explanation (interpretation, naive approach, insight, proof, complexity, Python implementation, tests, common mistakes, alternatives) is hidden and lazy-loaded. Reveal it only after a meaningful attempt - the struggle is where the learning happens.