P1045 [NOIP 2003 Junior] Mersenne Number

Description

A prime of the form $2^{P}-1$ is called a "Mersenne number"; in that case $P$ must also be a prime. The converse is not necessarily true, i.e., even if $P$ is prime, $2^{P}-1$ may not be prime. By the end of 1998, 37 Mersenne numbers had been found. The largest one had $P=3021377$, and it has 909526 digits. Mersenne numbers have many important applications and are closely related to perfect numbers. Task: Given $P$ ($1000

Input Format

The file contains a single integer $P$ ($1000

Output Format

- Line 1: The number of digits of the decimal big integer $2^{P}-1$. - Lines 2–11: The last $500$ digits of the decimal big integer $2^{P}-1$ (50 digits per line, 10 lines in total; if there are fewer than 500 digits, pad with leading zeros on the most significant side). You do not need to verify whether $2^{P}-1$ or $P$ is prime.

Explanation/Hint

**[Problem Source]** NOIP 2003 Junior Problem 4 Translated by ChatGPT 5