HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > IMPC-2014-15 Questions > problem:


3rd-3. 50474 - Sum of Two Primes

IMPC-2014-15 Questions

Start: Nov.22.2014 at 03:00:00 PM
Finish: Nov.22.2014 at 08:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 1st-4. 50473 - Counting Circles Posit...
• 1st-6. 50485 - Center of gravity of ...
• 2nd-1. 50522 - Multiplication Table - 2
• 2nd-2. 50512 - Coding redundancy
• 2nd-3. 50533 - Contacts List
• 2nd-5. 50793 - Top M Customers
• 2nd-6. 50486 - Problems and Progr...
• 3rd-2. 50405 - Accounts Receivable
• 3rd-3. 50474 - Sum of Two Primes
• 3rd-4. 50406 - Draw Pattern 178
• 3rd-5. 50415 - The Scientist
• 3rd-6. 50695 - Longest link between...
• 4th-1. 50491 - Brokers
• 4th-2. 50524 - Elevator
• 4th-3. 50535 - Image Compression
• 4th-6. 50536 - Epoka Furgon Shpk
• Ind_01-10. 50752 - Student Groups

Feedback

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

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Arban Uka (Modified by Sidrit Reka).

Sum of Two Primes

Our math professor is very interested in the properties of the prime numbers. He is trying to prove that all the even numbers can be represented as a sum of two prime numbers. He wants to find a mathematical proof and in the meantime he asks you to make a program that tries to represent the even numbers as the sum of two primes. Note that some even numbers can be represented by some different pairs of prime numbers. For example, 16 = 3 + 13 or 5 + 11. The professor in this case wants to have only the first pair (3, 13) because he wants the first prime number to be as small as possible (in this case it is 3).

Question: Given two even numbers a and b, for all the even numbers from a to b, try to find two prime numbers whose sum is equal to the required number.

Input specification
In the first line you will given an even integer a and in the second line you will be given an even integer b (1 < a, b < 100000).

Output specification
Try to express each of the even numbers between a and b as the sum of two prime numbers. If it cannot be represented as a sum of to primes, just output "NO WAY" as it is shown in the sample output.


Sample Input I
2
10
Sample Input II
10
20
Sample Output I
2 = NO WAY
4 = 2 2
6 = 3 3
8 = 3 5
10 = 3 7
Sample Output II
10 = 3 7
12 = 5 7
14 = 3 11
16 = 3 13
18 = 5 13
20 = 3 17


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

www.contester.ru