M_SEQ - Mosty! Find Gn

Omar want to examine Mostafa in math, Mostafa asked to give G(n) that defined as:

G(n) = sqrt( F(n) - ( (n-1)^2 * F(n-1) / n^2 ) + 1/n^2 )

while:

F(n) = 8 + ( ((n-2)^2 )*(F(n-2)) /n^2 )

Mostafa need your help to find G(n) (n : given integer)

assume that : F(1) = 8, F(2) = 8;

Input

T number of test cases in the first line, T line follow with an integer n.

Output

Print G(n) for each test case with 8 decimal digits after the point (0 < G(n) < 3)

Example

Input:
3
5
7
42
Output: 2.20000000 2.14285714 2.02380952

Constraints

T < 10^4
2 < n < 10^9


Added by:omar alkattan
Date:2013-02-20
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:own

hide comments
2022-08-12 06:09:13
Can somebody give me some clues ? (Not good at maths)
2020-01-15 00:20:38
How is F(n) defined?

Edit: Source under missing pic says:
F(n) = 8 + ( ((n-2)^2 ) * (F(n-2)) / n^2 )

Last edit: 2020-01-15 00:23:24
2017-01-26 07:21:19
Maths,Maths,Maths...
2017-01-23 13:42:29
how to solve this problem? please help me...
2015-10-30 00:31:34 rahul_verma
nice & easy maths !!!! AC in 1st go...
0.00 sec

Last edit: 2015-10-30 00:32:30
2015-09-22 21:55:50
Yup..in one go..
2015-07-01 19:16:59 ASHUTOSH DWIVEDI
@ checks
try to make formula not loop....Bdw good use of maths....

Last edit: 2015-07-01 19:18:28
2014-12-30 08:37:14 Satyam Mishra
little pen and paper work to do.....
enjoyed solving this.
2014-10-15 16:27:35 Raghav Aggiwal
Ac in one go!

2015-01-30 06:35:34 RIVU DAS
Easy one!!
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.