Question: Write python3.4 program that takes L and R as input and displays the number of prime numbers that lie between L and R (L and

Write python3.4 program that takes L and R as input and displays the number of prime numbers that lie between L and R (L and R inclusive) and can be represented as sum of two consecutive prime numbers + 1.

Example: Case 1: For the input provided as follows: 1 20 The output of the program will be: 2 Explanation 13 is a prime number which can be expressed like 5+7+1. 19 is a prime number which can be expressed like 7+11+1. So the output is 2. Note that 5 and 7 are consecutive primes. Similarly, 7 and 11 are consecutive primes. Case 2: For the input provided as follows: 1 10 Output of the program will be: 0 Explanation No prime numbers lie between 1 and 10 that can be represented as sum of two consecutive prime numbers + 1, hence 0 is displayed.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!