freeCodeCamp/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-354-distances-in-a-...

1.2 KiB

id challengeType title forumTopicId
5900f4cf1000cf542c50ffe1 5 Problem 354: Distances in a bee's honeycomb 302014

Description

Consider a honey bee's honeycomb where each cell is a perfect regular hexagon with side length 1.

One particular cell is occupied by the queen bee. For a positive real number L, let B(L) count the cells with distance L from the queen bee cell (all distances are measured from centre to centre); you may assume that the honeycomb is large enough to accommodate for any distance we wish to consider. For example, B(√3) = 6, B(√21) = 12 and B(111 111 111) = 54.

Find the number of L ≤ 5·1011 such that B(L) = 450.

Instructions

Tests

tests:
  - text: <code>euler354()</code> should return 58065134.
    testString: assert.strictEqual(euler354(), 58065134);

Challenge Seed

function euler354() {
  // Good luck!
  return true;
}

euler354();

Solution

// solution required