Files
gikf 32dbe23f5e fix(curriculum): clean-up Project Euler 301-320 (#42926)
* fix: clean-up Project Euler 301-320

* fix: corrections from review

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
2021-07-21 17:59:56 +02:00

1.5 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
5900f4a61000cf542c50ffb8 Problem 313: Sliding game 5 301969 problem-313-sliding-game

--description--

In a sliding game a counter may slide horizontally or vertically into an empty space. The objective of the game is to move the red counter from the top left corner of a grid to the bottom right corner; the space always starts in the bottom right corner. For example, the following sequence of pictures show how the game can be completed in five moves on a 2 by 2 grid.

completing game in five moves on grid 2x2

Let S(m, n) represent the minimum number of moves to complete the game on an m by n grid. For example, it can be verified that S(5, 4) = 25.

initial grid state and final grid state for game on grid 5x4

There are exactly 5482 grids for which S(m, n) = p^2, where p &lt; 100 is prime.

How many grids does S(m, n) = p^2, where p &lt; {10}^6 is prime?

--hints--

slidingGame() should return 2057774861813004.

assert.strictEqual(slidingGame(), 2057774861813004);

--seed--

--seed-contents--

function slidingGame() {

  return true;
}

slidingGame();

--solutions--

// solution required