freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-94-almost-equilateral-triangles.english.md
mrugesh 22afc2a0ca feat(learn): python certification projects (#38216)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com>
Co-authored-by: Beau Carnes <beaucarnes@gmail.com>
2020-05-27 13:19:08 +05:30

1.4 KiB

id, challengeType, isHidden, title, forumTopicId
id challengeType isHidden title forumTopicId
5900f3ca1000cf542c50fedd 5 false 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