freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-261-pivotal-square-...

67 lines
1.1 KiB
Markdown
Raw Normal View History

---
id: 5900f4711000cf542c50ff84
challengeType: 5
title: 'Problem 261: Pivotal Square Sums'
forumTopicId: 301910
---
## Description
<section id='description'>
Let us call a positive integer k a square-pivot, if there is a pair of integers m > 0 and n ≥ k, such that the sum of the (m+1) consecutive squares up to k equals the sum of the m consecutive squares from (n+1) on:
(k-m)2 + ... + k2 = (n+1)2 + ... + (n+m)2.
Some small square-pivots are
4: 32 + 42
= 52
21: 202 + 212 = 292
24: 212 + 222 + 232 + 242 = 252 + 262 + 272
110: 1082 + 1092 + 1102 = 1332 + 1342Find the sum of all distinct square-pivots ≤ 1010.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler261()</code> should return 238890850232021.
testString: assert.strictEqual(euler261(), 238890850232021);
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler261() {
return true;
}
euler261();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>