chore(i8n,learn): processed translations
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
15047f2d90
commit
e5c44a3ae5
@ -1,90 +1,96 @@
|
||||
---
|
||||
id: 594810f028c0303b75339ad1
|
||||
title: 快乐的数字
|
||||
title: Happy numbers
|
||||
challengeType: 5
|
||||
videoUrl: ''
|
||||
forumTopicId: 302280
|
||||
dashedName: happy-numbers
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
<p>幸福的数字由以下过程定义: </p><p>从任何正整数开始,将数字替换为其数字的平方和,并重复该过程直到数字等于1(它将保持不变),或者它在一个不包括1的循环中无休止地循环。这些数字这个过程在1结束的是幸福的数字,而那些不以1结尾的数字是不愉快的数字。 </p><p>实现一个函数,如果数字是满意的,则返回true,否则返回false。 </p>
|
||||
A [happy number](https://en.wikipedia.org/wiki/Happy_number) is defined by the following process:
|
||||
|
||||
Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals `1` (where it will stay), or it loops endlessly in a cycle which does not include `1`. Those numbers for which this process ends in `1` are happy numbers, while those that do not end in `1` are unhappy numbers.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Implement a function that returns true if the number is happy, or false if not.
|
||||
|
||||
# --hints--
|
||||
|
||||
`happy`是一种功能。
|
||||
`happy` should be a function.
|
||||
|
||||
```js
|
||||
assert(typeof happy === 'function');
|
||||
```
|
||||
|
||||
`happy(1)`应该返回一个布尔值。
|
||||
`happy(1)` should return a boolean.
|
||||
|
||||
```js
|
||||
assert(typeof happy(1) === 'boolean');
|
||||
```
|
||||
|
||||
`happy(1)`应该回归真实。
|
||||
`happy(1)` should return true.
|
||||
|
||||
```js
|
||||
assert(happy(1));
|
||||
```
|
||||
|
||||
`happy(2)`应该返回虚假。
|
||||
`happy(2)` should return false.
|
||||
|
||||
```js
|
||||
assert(!happy(2));
|
||||
```
|
||||
|
||||
`happy(7)`应该回归真实。
|
||||
`happy(7)` should return true.
|
||||
|
||||
```js
|
||||
assert(happy(7));
|
||||
```
|
||||
|
||||
`happy(10)`应该回归真实。
|
||||
`happy(10)` should return true.
|
||||
|
||||
```js
|
||||
assert(happy(10));
|
||||
```
|
||||
|
||||
`happy(13)`应该回归真实。
|
||||
`happy(13)` should return true.
|
||||
|
||||
```js
|
||||
assert(happy(13));
|
||||
```
|
||||
|
||||
`happy(19)`应该回归真实。
|
||||
`happy(19)` should return true.
|
||||
|
||||
```js
|
||||
assert(happy(19));
|
||||
```
|
||||
|
||||
`happy(23)`应该回归真实。
|
||||
`happy(23)` should return true.
|
||||
|
||||
```js
|
||||
assert(happy(23));
|
||||
```
|
||||
|
||||
`happy(28)`应该回归真实。
|
||||
`happy(28)` should return true.
|
||||
|
||||
```js
|
||||
assert(happy(28));
|
||||
```
|
||||
|
||||
`happy(31)`应该回归真实。
|
||||
`happy(31)` should return true.
|
||||
|
||||
```js
|
||||
assert(happy(31));
|
||||
```
|
||||
|
||||
`happy(32)`应该回归真实:
|
||||
`happy(32)` should return true:.
|
||||
|
||||
```js
|
||||
assert(happy(32));
|
||||
```
|
||||
|
||||
`happy(33)`应该返回虚假。
|
||||
`happy(33)` should return false.
|
||||
|
||||
```js
|
||||
assert(!happy(33));
|
||||
|
Reference in New Issue
Block a user