HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Arithmetic > problem:


50578 - Mersenne prime

Guest
• Review clarifications (2)

Section problems

• 50554 - nth power of m
• 50557 - nth Power of m (Long Multiply)
• 50559 - Prime Factors of a Number
• 50565 - Binary numbers
• 50568 - Body Mass Index Calculator
• 50571 - Armstrong Numbers - 2
• 50572 - Palindromic Numbers
• 50574 - Triangular Numbers
• 50578 - Mersenne prime
• 50579 - Pentagonal Numbers
• 50581 - The roots of a quadratic eq...
• 50582 - Number of digits
• 50583 - Max of 3 numbers
• 50584 - Total invoice amount
• 50585 - Inner Product
• 50587 - Modular Conversion
• 50595 - Sum of the numbers

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