## Almost Square Triangles

A*perfect square*is any integer in the form \(n^2\) where \(n\) is an integer. A

*triangle number*is any integer in the form \(\frac{n(n+1)}{2}\) where \(n\) is an integer. An

*almost-square-triangle*is any triangle number which is one less than a perfect square. For example: \(3\) is an almost-square-triangle because \(3\) is a triangle number and \(4\) is a perfect square. Let \(S(x)\) denote the sum of all almost-square-triangles less than \(x\). Since \(3\) and \(0\) are the only almost-square-triangles less than \(10\), we have \(S(10) = 3\).

Part A | What is \(S(1000)\)? | |
---|---|---|

Part B | What is the remainder when \(S(10^{12})\) is divided by \((10^9+7)\)? | |

Part C | What is the remainder when \(S(10^{1000})\) is divided by \((10^9+7)\)? |