Files
freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-242-odd-triplets.md
Oliver Eyton-Williams ee1e8abd87 feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script

* chore(curriculum): remove empty sections' markers

* chore(curriculum): add seed + solution to Chinese

* chore: remove old formatter

* fix: update getChallenges

parse translated challenges separately, without reference to the source

* chore(curriculum): add dashedName to English

* chore(curriculum): add dashedName to Chinese

* refactor: remove unused challenge property 'name'

* fix: relax dashedName requirement

* fix: stray tag

Remove stray `pre` tag from challenge file.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>

Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2021-01-12 19:31:00 -07:00

1013 B

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
5900f45f1000cf542c50ff71 Problem 242: Odd Triplets 5 301889 problem-242-odd-triplets

--description--

Given the set {1,2,...,n}, we define f(n,k) as the number of its k-element subsets with an odd sum of elements. For example, f(5,3) = 4, since the set {1,2,3,4,5} has four 3-element subsets having an odd sum of elements, i.e.: {1,2,4}, {1,3,5}, {2,3,4} and {2,4,5}.

When all three values n, k and f(n,k) are odd, we say that they make an odd-triplet [n,k,f(n,k)].

There are exactly five odd-triplets with n ≤ 10, namely: [1,1,f(1,1) = 1], [5,1,f(5,1) = 3], [5,5,f(5,5) = 1], [9,1,f(9,1) = 5] and [9,9,f(9,9) = 1].

How many odd-triplets are there with n ≤ 1012 ?

--hints--

euler242() should return 997104142249036700.

assert.strictEqual(euler242(), 997104142249036700);

--seed--

--seed-contents--

function euler242() {

  return true;
}

euler242();

--solutions--

// solution required