M_SEQ - Mosty! Find Gn

no tags 

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


hide comments
egplayer: 2022-08-12 06:09:13

Can somebody give me some clues ? (Not good at maths)

nadstratosfer: 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
cs_abhi2000: 2017-01-26 07:21:19

Maths,Maths,Maths...

okyan48: 2017-01-23 13:42:29

how to solve this problem? please help me...

rahul_verma: 2015-10-30 00:31:34

nice & easy maths !!!! AC in 1st go...
0.00 sec

Last edit: 2015-10-30 00:32:30
adi_tri: 2015-09-22 21:55:50

Yup..in one go..

ASHUTOSH DWIVEDI: 2015-07-01 19:16:59

@ checks
try to make formula not loop....Bdw good use of maths....

Last edit: 2015-07-01 19:18:28
Satyam Mishra: 2014-12-30 08:37:14

little pen and paper work to do.....
enjoyed solving this.

Raghav Aggiwal: 2014-10-15 16:27:35

Ac in one go!

RIVU DAS: 2015-01-30 06:35:34

Easy one!!


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