freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/project-euler/problem-242-odd-triplets.ch...

1.3 KiB
Raw Blame History

id challengeType title videoUrl localeTitle
5900f45f1000cf542c50ff71 5 Problem 242: Odd Triplets 问题242奇数三胞胎

Description

给定集合{1,2...n}我们将fnk定义为具有奇数元素之和的k元素子集的数量。例如f5,3= 4因为集合{1,2,3,4,5}有四个3元素子集具有奇数元素{1,2,4}{ 1,3,5}{2,3,4}和{2,4,5}。

当所有三个值nk和fnk都是奇数时我们说它们产生奇数三元组[nkfnk]。

正好有五个奇数三元组n≤10[1,1f1,1= 1][5,1f5,1= 3][5,5f 5,5= 1][9,1f9,1= 5]和[9,9f9,9= 1]。

n≤1012有多少奇数三胞胎

Instructions

Tests

tests:
  - text: <code>euler242()</code>应该返回997104142249036700。
    testString: 'assert.strictEqual(euler242(), 997104142249036700, "<code>euler242()</code> should return 997104142249036700.");'

Challenge Seed

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

euler242();

Solution

// solution required