QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 256 MB مجموع النقاط: 100

#3531. 素数还是数字

الإحصائيات

你可能已经知道什么是质数了。为了以防万一,我们回顾一下:质数是一个有且仅有两个不同正整数约数的正整数。事实上,这个定义极大地限制了你的思维,所以让我们尝试给出一个质数的等价定义……

质数是一个大于 1 的整数 $p$,使得不存在一对整数 $x$ 和 $y$ 满足 $x \times y = p$ 且 $1 < x \le y < p$。看起来什么都没变,但实际上这极大地扩展了你的思维。也许在阅读这个定义时,你想到的是乘法运算下的质数。是的,如果我们假设“$\times$”是乘法运算,这是正确的。但如果“$\times$”不是乘法运算,而是按位“或”(OR)运算呢?现在你能判断一个数 $n$ 是否为质数了吗?让我们来试一试!

输入格式

输入包含一行,一个整数 $n$ —— 你需要判断它是否为按位“或”运算下的质数。

$1 \le n \le 10^{18}$

输出格式

输出一行,如果该数是按位“或”运算下的质数,则输出“Yes”,否则输出“No”。

样例

样例输入 1

2

样例输出 1

Yes

样例输入 2

42

样例输出 2

No

说明

两个非负整数 $a$ 和 $b$ 的按位或运算结果为 $c = a \text{ OR } b$,其二进制表示中的每一位为 1,当且仅当 $a$ 或 $b$ 在对应二进制位上至少有一个为 1。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.