Time limit 4000/7000/4000/7000 ms. Memory limit 65000/65000/65000/65000 Kb. Question by Arban Uka.
Mersenne Prime
Shqip
Mersenne Prime is a prime a number which can be expressed in the form
Mn = 2n - 1 . They are named after the French scientist Marin Mersenne.
Write a program which is going to read n numbers then output the number of Mersenne primes in the given list.
Input specification
The first line contains a number (n) where 2 ≤ n ≤ 100. The following n lines has one number in each
where each of the numbers is between 1 and 1013.
Output specification
Show just one number that shows the number of Mersenne Prime numbers in the given list.
Sample Input:
5
1
7
15
31
5
Sample Output:
2
Output Explanation:
There are 6 input numbers:
- 1 is not a prime number
- 7 is prime and in the form of
Mn = 2n - 1 and thus is Mersenne Prime.
- 15 is not a prime number
- 31 is Mersenne Prime
- 5 is prime but not a Mersenne Prime
There are only two Mersenne Primes in the given list.
Sample Input 2:
5
511
8191
321051687
1099511627775
2199023255552
Sample Output 2:
1
Only 8191 is Mersenne Prime number.
Для отправки решений необходимо выполнить вход.
|