BEMINE - Bermuda Love Triangle
Bermuda triangle is also known as Devil's triangle. Many people disappeared their with their ships/planes. Love triange is a triangle where when someone gets into it's uncertainity he disappears from himself. So bermuda love triangle is a triangle where there is uncertainity from each angle. Here is a story of Barmuda love triangle, where 3 vertex consists of 2 girls and a boy. Both of the girls love the boy and they are best friends also. The boy feels same for the both girls. So, its a Uncertainity-Uncertainity-Uncertainity triangle. As this can't go like this, they all want a solution. As students of CS department they found a solution.
The boy will be holding two infinite series in two hands, the first girl will pick a series, the 2nd girl gets the rest. Then the 2nd girl will tell a number x where both sequence will end. Now , whose result of the series will have a larger prime divisor will get the boy. If the result for both series is equal then they will all be friends.
Given the serieses, first girl's choice, second girl's choosen x, find who will win the boy, or they will be friends.
Series 1= 1+2+3+4+5+6+..................+x
Series 2= 0!+1*1!+2*2!+3*3!+4*4!+...............+x*x!
Use faster I/O
The first line contains an integer 0<t<10000 , number of testcases.
Next t lines contain 2 integer 1<=s<=2 and 2<=x<=108 ,Here s is the choice of the first girl, and x is the end of the series.
For each testcase print "First" if the first girl wins the boy, print "Second" if the second one wins, "Friends" else.
Thanks for the reply nadstratosfer. It clarified some serious misunderstanding I had regarding the problem.
How are the largest prime divisors in case of 36 same?