1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/回文质数 [prime-palindrome].html

48 lines
1.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个整数 <code>n</code> ,返回大于或等于 <code>n</code> 的最小&nbsp;<stron><strong>回文质数</strong></stron></p>
<!-- 一个整数是素数的定义以及1不是素数的说明 -->
<p>一个整数如果恰好有两个除数:<code>1</code> 和它本身,那么它是 <strong>质数</strong> 。注意,<code>1</code> 不是质数。</p>
<ul>
<li>例如,<code>2</code><code>3</code><code>5</code><code>7</code><code>11</code><code>13</code> 都是质数。</li>
</ul>
<p>一个整数如果从左向右读和从右向左读是相同的,那么它是<strong> 回文数 </strong></p>
<ul>
<li>例如,<code>101</code><code>12321</code> 都是回文数。</li>
</ul>
<p>测试用例保证答案总是存在,并且在 <code>[2, 2 * 10<sup>8</sup>]</code> 范围内。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<pre>
<strong>输入:</strong>n = 6
<strong>输出:</strong>7
</pre>
<p><strong class="example">示例 2</strong></p>
<pre>
<strong>输入:</strong>n = 8
<strong>输出:</strong>11
</pre>
<p><strong class="example">示例 3</strong></p>
<pre>
<strong>输入:</strong>n = 13
<strong>输出:</strong>101
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 10<sup>8</sup></code></li>
</ul>