yaworsw/euler-manager

View on GitHub
data/problems/326.yml

Summary

Maintainability
Test Coverage
---
:id: 326
:name: Modulo Summations
:url: https://projecteuler.net/problem=326
:content: |+
  Let <var>a<sub>n</sub></var> be a sequence recursively defined by: ![p326_formula1.gif]({{ images_dir }}/p326_formula1.gif).

  So the first 10 elements of <var>a<sub>n</sub></var> are: 1,1,0,3,0,3,5,4,1,9.

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

   ![p326_formula2.gif]({{ images_dir }}/p326_formula2.gif)

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

  You are also given that <var>f</var>(10<sup>4</sup>,10<sup>3</sup>)=97158.

  Find <var>f</var>(10<sup>12</sup>,10<sup>6</sup>).