Programming contests

ECN selejtező programozó csapatverseny, 2018. április 21.

April 21, 2018 10:15 AM – April 21, 2018 3:15 PM

Prime Palindromes

The number 181 is a prime palindrome because it is both a prime number and a palindrome. A palindrome is a number that is the same when read forward as backward. Write a program that determines how many prime palindromes there are between two numbers.

Input Specification

The input will contain five sets of data, one per line. Each set will contain two integers L and U, the range of numbers to determine the prime palindromes (2 ≤ L ≤ U ≤ 999 999).

Output Specification

For each input line, output one line with the number of prime palindromes between L and U, inclusive.

Sample Input (with 3 sets of data)

  1. 2 10
  2. 100 200
  3. 10000 20000
download as text file

Output for Sample Input

  1. 4
  2. 5
  3. 26
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019