Back to Freecodecamp

Problem 136: Singleton difference

curriculum/challenges/english/blocks/project-euler-problems-101-to-200/5900f3f51000cf542c50ff07.md

latest743 B
Original Source

--description--

The positive integers, $x$, $y$, and $z$, are consecutive terms of an arithmetic progression. Given that $n$ is a positive integer, the equation, $x^2 − y^2 − z^2 = n$, has exactly one solution when $n = 20$:

$$13^2 − 10^2 − 7^2 = 20$$

In fact, there are twenty-five values of $n$ below one hundred for which the equation has a unique solution.

How many values of $n$ less than fifty million have exactly one solution?

--hints--

singletonDifference() should return 2544559.

js
assert.strictEqual(singletonDifference(), 2544559);

--seed--

--seed-contents--

js
function singletonDifference() {

  return true;
}

singletonDifference();

--solutions--

js
// solution required