← Complete problem index

PROJECT EULER · #0304

Primonacci

Statement only · SolvedOriginal problem ↗

For any positive integer n the function next_prime(n) returns the smallest prime p such that p>n.

The sequence a(n) is defined by:
a(1)=next_prime(1014) and a(n)=next_prime(a(n1)) for n>1.

The Fibonacci sequence f(n) is defined by: f(0)=0, f(1)=1 and f(n)=f(n1)+f(n2) for n>1.

The sequence b(n) is defined as f(a(n)).

Find b(n) for 1n100000. Give your answer mod 1234567891011.

Write-up coming later

The complete problem is available here. An approach, code, and answer will be added later.