No.354 Mersenne Prime
レベル :
/ AI推定難易度 : 101
/ 実行時間制限 : 1ケース 1.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 560
作問者 :
roiti46
タグ : / 解いたユーザー数 560
作問者 :
問題文最終更新日: 2026-06-25 04:19:07
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder April Contest
(順位表)
の他の問題:
Problem Statement
In January 2018, the largest Mersenne prime ever known (the 50th one) was discovered.
A Mersenne prime is a prime number that can be expressed in the form 2$p$ - 1.
So, when a Mersenne prime is written in binary, find the sum of its digits (that is, the number of 1s).
Input
$p$
$p$: the exponent (an integer) of the Mersenne prime 2$p$ - 1
$p$ is at most that of the largest Mersenne prime currently confirmed to exist (77232917 as of January 2018)
(Additions of larger test cases are welcome.)
Output
Output the sum of the digits of the given Mersenne prime when written in binary.
Sample
Sample 1
Input
2
Output
2
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。