Files
freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/rosetta-code/harshad-or-niven-series.chinese.md
Kristofer Koishigawa b3213fc892 fix(i18n): chinese test suite (#38220)
* fix: Chinese test suite

Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working.

* fix: ran script, updated testStrings and solutions
2020-03-03 18:49:47 +05:30

1.6 KiB
Raw Blame History

title, id, challengeType, videoUrl, localeTitle
title id challengeType videoUrl localeTitle
Harshad or Niven series 595668ca4cfe1af2fb9818d4 5 Harshad或Niven系列

Description

Harshad或Niven数是正整数≥1可以被它们的数字之和整除。

例如42是Harshad数因为42可以被4 + 2整除而没有余数。

假设系列被定义为按递增顺序排列的数字。任务:

实现一个函数来生成Harshad序列的连续成员。

使用它列出序列的前20个成员并列出第一个大于1000的Harshad数。

Instructions

Tests

tests:
  - text: <code>isHarshadOrNiven</code>是一个函数。
    testString: assert(typeof isHarshadOrNiven === 'function');
  - text: '<code>isHarshadOrNiven()</code>应该返回<code>{"firstTwenty": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42],"firstOver1000": 1002}</code>'
    testString: assert.deepEqual(isHarshadOrNiven(), res);

Challenge Seed

function isHarshadOrNiven () {
  const res = {
    firstTwenty: [],
    firstOver1000: undefined
  };
  // Change after this line

  return res;
}

After Test

console.info('after the test');

Solution

// solution required