1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 19:18:14 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/完美数 [perfect-number].html

29 lines
816 B
HTML
Raw Normal View History

2022-03-27 20:52:13 +08:00
<p>对于一个&nbsp;<strong>正整数</strong>,如果它和除了它自身以外的所有 <strong>正因子</strong> 之和相等,我们称它为 <strong>「完美数」</strong></p>
<p>给定一个&nbsp;<strong>整数&nbsp;</strong><code>n</code>&nbsp;如果是完美数,返回 <code>true</code>;否则返回 <code>false</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>num = 28
<strong>输出:</strong>true
<strong>解释:</strong>28 = 1 + 2 + 4 + 7 + 14
1, 2, 4, 7, 和 14 是 28 的所有正因子。</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>num = 7
<strong>输出:</strong>false
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= num &lt;= 10<sup>8</sup></code></li>
</ul>