FAVDICE - Favorite Dice

no tags 

BuggyD loves to carry his favorite die around. Perhaps you wonder why it's his favorite? Well, his die is magical and can be transformed into an N-sided unbiased die with the push of a button. Now BuggyD wants to learn more about his die, so he raises a question:

What is the expected number of throws of his die while it has N sides so that each number is rolled at least once?

Input

The first line of the input contains an integer t, the number of test cases. t test cases follow.

Each test case consists of a single line containing a single integer N (1 <= N <= 1000) - the number of sides on BuggyD's die.

Output

For each test case, print one line containing the expected number of times BuggyD needs to throw his N-sided die so that each number appears at least once. The expected number must be accurate to 2 decimal digits.

Example

Input:
2
1
12

Output:
1.00
37.24

hide comments
prasanth292130: 2017-10-24 19:13:39

Coupon collector problem.............AC in a go...

rohan_gulati: 2017-06-09 09:16:54

Coupon Collector Problem:
https://www.youtube.com/watch?v=3mu47FWEuqA

Last edit: 2017-06-09 09:17:07
rohit9934: 2017-05-06 19:45:32

Simple Probabilty problem. #math tag.

vladimira: 2017-03-16 07:37:01

Coupon collecter problem, very useful piece of knowledge. Great problem.

starbot: 2017-03-14 12:59:14

Geometric random variable>>>>AC...

nilabja16180: 2017-03-07 21:02:58

Coupon Collector problem, helped!

scorpion_ajay: 2017-03-02 21:23:28

Mathematics always screw me...
learned something new...
HINT : expected number of trials until success = 1/p given p is the probability of success in every trial.

harshil014: 2016-09-11 19:08:23

Is there any new approach?

Last edit: 2016-09-11 19:09:45
ashishranjan28: 2016-09-09 22:26:51

coupon collector application

Pratik S: 2016-08-21 04:54:46

Why is this argument wrong?
Let E(n) be the desired expectation.
Now Choose some n-1 of these n numbers. The number of turns required for getting these at least once is E(n-1). Now the exp. number of throws to get that last number is n, So total number of exp throws is E(n-1) + n. Since we could have chosen any number as the last number in an equally likely way, the expectation recurrence should be:-
E(n) = n*(E(n-1)+n)/n
= E(n-1)+n
Blows my mind ... can't find the fault!!!


Added by:Matthew Reeder
Date:2006-10-29
Time limit:0.391s
Source limit:30000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:Al-Khawarizm 2006