HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Functions > problem:


125. 50578 - Mersenne prime

Guest
• Review clarifications (2)

Volume problems

• 070. 50534 - Top Trading Company
• 076. 50289 - Monthly Allowance
• 080. 50347 - Selling Oranges
• 090. 50378 - Sum of the given digits
• 095. 50453 - The Cubic Difference
• 100. 50397 - The Number of Points ...
• 110. 50409 - Random Password Ge...
• 120. 50684 - Sum of prime numbers...
• 125. 50578 - Mersenne prime
• 130. 50652 - Prime Factorization
• 132. 50474 - Sum of Two Primes
• 135. 50572 - Palindromic Numbers
• 140. 50393 - Palindromic Numbers
• 145. 50586 - Prime Palindromes
• 148. 50412 - K numbers
• 150. 50375 - Area of Circles
• 160. 50388 - Number of Armstrong ...

Feedback

If you notice incorrect translations in Contester, please let author know.

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.

Для отправки решений необходимо выполнить вход.

www.contester.ru