La2955 vivian puzzle – Mason

Question meaning

Enter $k$ (1 \leq k \leq 100) positive integers $p_1, p_2, …, p_k$(1 0$, $e_i$ cannot be all 0. If there is no solution, output NO, otherwise output the largest $x$.

Analysis

Masson number: $2^p-1$, exponent $p$ is a prime number. It is often recorded as $Mp$.

If the Mersenne number is prime, it is called Mersenne prime.

If $2^n-1$ is a prime number, then the exponent $n$ is also a prime number (assuming $n$ is a composite number, $2^n-1$ must be decomposed)

If $n$ is a prime number, $2^n-1$ may not be a prime number.

There is an important property: “A number can be written as the product of $n$ non-repetitive Mersenne prime numbers” is equivalent to “The sum of the divisors of this number is a power of 2.”

For example, $2^3-1=7$, the divisors of 7 are 1 and 7, $1+7 = 2^3$

Must be unique, $3 \ times 3 = 9$, but the divisors 1, 3, 6, 9, and sum of 9 are not powers of 2.

Within the scope of the question, there are only 8 Mersenne primes.

Share pictures

Code

It feels like a burst search is enough, I can’t write

p>

Reference link:

1. https://blog.csdn.net/miku23736748/article/details/52135932

p>

2. https://blog.csdn.net/acm_cxlove/article/details/7860735

Leave a Comment

Your email address will not be published.