Files
freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-75-singular-integer-right-triangles.english.md
Oliver Eyton-Williams bd68b70f3d Feat: hide blocks not challenges (#39504)
* fix: remove isHidden flag from frontmatter

* fix: add isUpcomingChange

Co-authored-by: Ahmad Abdolsaheb <ahmad.abdolsaheb@gmail.com>

* feat: hide blocks not challenges

Co-authored-by: Ahmad Abdolsaheb <ahmad.abdolsaheb@gmail.com>

Co-authored-by: Ahmad Abdolsaheb <ahmad.abdolsaheb@gmail.com>
2020-09-03 15:07:40 -07: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