Files
freeCodeCamp/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-94-almost-equilateral-triangles.english.md
Kristofer Koishigawa 6cfd0fc503 fix: improve Project Euler descriptions, challenge seeds, and test cases (#38016)
* fix: improve Project Euler descriptions and test case

Improve formatting of Project Euler test descriptions. Also add poker hands array and new test case for problem 54

* feat: add typeof tests and gave functions proper names for first 100 challenges

* fix: continue fixing test descriptions and adding "before test" sections

* fix: address review comments

* fix: adjust grids in 18 and 67 and fix some text that reference files rather than the given arrays

* fix: implement bug fixes and improvements from review

* fix: remove console.log statements from seed and solution
2020-02-28 06:39:47 -06:00

1.4 KiB

id, challengeType, title, forumTopicId
id challengeType title forumTopicId
5900f3ca1000cf542c50fedd 5 Problem 94: Almost equilateral triangles 302211

Description

It is easily proved that no equilateral triangle exists with integral length sides and integral area. However, the almost equilateral triangle 5-5-6 has an area of 12 square units.

We shall define an almost equilateral triangle to be a triangle for which two sides are equal and the third differs by no more than one unit.

Find the sum of the perimeters of all almost equilateral triangle with integral side lengths and area and whose perimeters do not exceed one billion (1,000,000,000).

Instructions

Tests

tests:
  - text: <code>almostEquilateralTriangles()</code> should return a number.
    testString: assert(typeof almostEquilateralTriangles() === 'number');
  - text: <code>almostEquilateralTriangles()</code> should return 518408346.
    testString: assert.strictEqual(almostEquilateralTriangles(), 518408346);

Challenge Seed

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

almostEquilateralTriangles();

Solution

// solution required