P968
projecteuler.net

5D Summation

ℹ️Published on Sunday, 9th November 2025, 01:00 am; Solved by 81;
Difficulty level: 33

Define $$P(X_{a,b},X_{a,c},X_{a,d},X_{a,e},X_{b,c},X_{b,d},X_{b,e},X_{c,d},X_{c,e},X_{d,e})$$ as the sum of $2^a3^b5^c7^d11^e$ over all quintuples of non-negative integers $(a, b, c, d, e)$ such that the sum of each two of the five variables is restricted by a given value. In other words, $a+b \le X_{a,b}$, $a+d \le X_{a,d}$, $b+e \le X_{b,e}$ etc.

For example, $P(2,2,2,2,2,2,2,2,2,2)=7120$ and $P(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) \equiv 799809376 \pmod{10^9 + 7}$.

Define a sequence $A$ as follows:

  • $A_0 = 1$, $A_1 = 7$;
  • $A_n =(7A_{n−1}+A_{n-2}^2) \bmod(10^9+7)$ for $n \ge 2$.

Also define $Q(n) = P(A_{10n}, A_{10n+1}, A_{10n+2}, \dots , A_{10n+9})$.

Find $\displaystyle\sum_{0 \le n \lt 100}Q(n)$. Give your answer modulo $10^9+7$.



Soluzione

Last modified: February 25, 2026. Website built with Franklin.jl and the lovely Julia programming language.