Files
freeCodeCamp/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-75-singular-integer-right-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.8 KiB

id, challengeType, title, forumTopicId
id challengeType title forumTopicId
5900f3b71000cf542c50feca 5 Problem 75: Singular integer right triangles 302188

Description

It turns out that 12 cm is the smallest length of wire that can be bent to form an integer sided right angle triangle in exactly one way, but there are many more examples.

12 cm: (3,4,5)
24 cm: (6,8,10)
30 cm: (5,12,13)
36 cm: (9,12,15)
40 cm: (8,15,17)
48 cm: (12,16,20)

In contrast, some lengths of wire, like 20 cm, cannot be bent to form an integer sided right angle triangle, and other lengths allow more than one solution to be found; for example, using 120 cm it is possible to form exactly three different integer sided right angle triangles.

120 cm: (30,40,50), (20,48,52), (24,45,51)

Given that L is the length of the wire, for how many values of L ≤ 1,500,000 can exactly one integer sided right angle triangle be formed?

Instructions

Tests

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

Challenge Seed

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

singularIntRightTriangles();

Solution

// solution required