yaworsw/euler-manager

View on GitHub
data/problems/120.yml

Summary

Maintainability
Test Coverage
---
:id: 120
:name: Square remainders
:url: https://projecteuler.net/problem=120
:content: |+
  Let _r_ be the remainder when (_a_−1)<sup><i>n</i></sup> + (_a_+1)<sup><i>n</i></sup> is divided by _a_<sup>2</sup>.

  For example, if _a_ = 7 and _n_ = 3, then _r_ = 42: 6<sup>3</sup> + 8<sup>3</sup> = 728 ≡ 42 mod 49. And as _n_ varies, so too will _r_, but for _a_ = 7 it turns out that _r_<sub>max</sub> = 42.

  For 3 ≤ _a_ ≤ 1000, find ∑ _r_<sub>max</sub>.