2nd Balkan Olympiad in Informatics
Thessaloniki, Greece, 1-6 October 1994

Day 1 - Problem 1 (25 points)

We wish to find all the numbers x (where 10 <=x <= 65535) which:

are prime numbers, and
are Fibonacci numbers of order two (see the hint), and
at least one different prime number is produced by permuting the digits of x.

The output should consist of a number of lines equal to the number of elements in the desired list. Each line should contain the number x and the prime number produced from x by permuting the digits of x, separated by a space.

The output should start as follows:
13 31

Hint:a prime number x may be divided only by 1 and x (1 is not a prime). The sequence of order two Fibonacci numbers is defined as follows:
Fi=Fi-1+Fi-2, for all i&gt1