HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Functions > problem:


125. 50578 - Mersenne prime

Guest
• Review clarifications (2)

Volume problems

• 016. 50459 - The Biggest Digit
• 020. 50575 - Number of Prime num...
• 030. 50576 - Number of Perfect nu...
• 050. 50510 - What floor are they?
• 050. 50566 - Grade Point Average (...
• 066. 50523 - Total Tax to Pay
• 070. 50534 - Top Trading Company
• 095. 50453 - The Cubic Difference
• 125. 50578 - Mersenne prime
• 132. 50474 - Sum of Two Primes
• 165. 50577 - Perfect Numbers and ...
• 190. 50533 - Contacts List
• 200. 50454 - What day is it?
• 210. 50369 - Base Conversion
• 250. 50385 - The 3n + 1 problem
• 260. 50493 - n-digit kth Prime Number
• 50307 - Palindromes

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