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

2.1 KiB
Raw Blame History

id, title, challengeType, videoUrl, dashedName
id title challengeType videoUrl dashedName
5900f50b1000cf542c51001d 问题414标题常量 5 problem-414-kaprekar-constant

--description--

6174是一个了不起的数字;如果我们按递增顺序对其数字进行排序并从按降序排序数字时得到的数字中减去该数字我们得到7641-1467 = 6174。更值得注意的是如果我们从任何4位数字开始并重复这个排序和减法过程我们最终将以6174结束或者如果所有数字相等则立即结束0。如果我们用前导零填充数字直到我们有4位数这也适用于少于4位的数字。例如让我们从数字0837开始8730-0378 = 8352 8532-2358 = 6174

6174被称为Kaprekar常数。排序和减去并重复这一过程直到0或达到Kaprekar常数的过程称为Kaprekar例程。

我们可以考虑其他基数和位数的Kaprekar例程。不幸的是并不能保证在所有情况下都存在Kaprekar常数;例程可以在某个输入数字的循环中结束或者例程到达的常数对于不同的输入数字可以是不同的。然而可以证明对于5位数并且基数b = 6t + 3≠9存在Kaprekar常数。例如基数1510,4,14,9,515基数2114,6,20,13,721

将Cb定义为基数b中的Kaprekar常数为5位数。如果i = Cb则将函数sbi定义为0或者如果i写入基数b则由5个相同的数字组成基数b中的Kaprekar例程到达Cb所需的迭代次数否则

注意我们可以为所有整数i <b5定义sbi。如果我在基数b中写入少于5位数则在应用Kaprekar例程之前我们有5位数字前面加零数字。

将Sb定义为0 <i <b5的sbi之和。例如S15= 5274369 S111= 400668930299

找到S6k + 3的总和2≤k≤300。给出最后18位数字作为答案。

--hints--

euler414()应该返回552506775824935500。

assert.strictEqual(euler414(), 552506775824935500);

--seed--

--seed-contents--

function euler414() {

  return true;
}

euler414();

--solutions--

// solution required