← Complete problem index

PROJECT EULER · #0326

Modulo Summations

Statement only · UnsolvedOriginal problem ↗

Let an be a sequence recursively defined by:a1=1,an=(k=1n1kak)modn.

So the first 10 elements of an are: 1,1,0,3,0,3,5,4,1,9.

Let f(N,M) represent the number of pairs (p,q) such that:

1pqNand(i=pqai)modM=0

It can be seen that f(10,10)=4 with the pairs (3,3), (5,5), (7,9) and (9,10).

You are also given that f(104,103)=97158.

Find f(1012,106).

Write-up coming later

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