#pragma comment(linker, "/stack:20000000")
#define _CRT_SECURE_NO_WARNINGS
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
using namespace std;
// Let's define unordered map
# ifdef __GNUC__
# if __cplusplus > 199711L
# include <unordered_set>
# include <unordered_map>
# else
# include <tr1/unordered_map>
# include <tr1/unordered_set>
using namespace tr1;
# endif
# else
# include <unordered_map>
# include <unordered_set>
# endif
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 6,5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,_6,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define DBN1(a) cerr<<#a<<"="<<(a)<<"\n"
#define DBN2(a,b) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBN3(a,b,c) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define DBN4(a,b,c,d) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN6(a,b,c,d,e,f) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<", "<<#f<<"="<<(f)<<"\n"
#define DBN(...) macro_dispatcher(DBN, __VA_ARGS__)(__VA_ARGS__)
#define DA(a,n) cerr<<#a<<"=["; printarray(a,n); cerr<<"]\n"
#define DAR(a,n,s) cerr<<#a<<"["<<s<<"-"<<n-1<<"]=["; printarray(a,n,s); cerr<<"]\n"
#ifdef _MSC_VER
#define ALIGN(x) __declspec(align(x))
#else
#define ALIGN(x) __attribute__((aligned(x)))
#endif
#ifdef LOCAL
#define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl
#else
#define CURTIME() ;
#endif
double __begin;
#define DTIME(ccc) __begin = clock(); ccc; cerr<<"Time of work = "<<(clock()-__begin)/CLOCKS_PER_SEC<<endl;
#define mp make_pair
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair< int , int > pii;
typedef pair< long long , long long > pll;
typedef vector< int > vi;
typedef vector< long long > vll;
typedef int itn;
template < class T1, class T2, class T3>
struct triple{ T1 a; T2 b; T3 c; triple( ) : a( T1( ) ) , b( T2( ) ) , c( T3( ) ) { } ; triple( T1 _a, T2 _b, T3 _c) : a( _a) , b( _b) , c( _c) { } } ;
template < class T1, class T2, class T3>
bool operator< ( const triple< T1,T2,T3> & t1,const triple< T1,T2,T3> & t2) { if ( t1.a ! = t2.a ) return t1.a < t2.a ; else if ( t1.b ! = t2.b ) return t1.b < t2.b ; else return t1.c < t2.c ; }
template < class T1, class T2, class T3>
bool operator> ( const triple< T1,T2,T3> & t1,const triple< T1,T2,T3> & t2) { if ( t1.a ! = t2.a ) return t1.a > t2.a ; else if ( t1.b ! = t2.b ) return t1.b > t2.b ; else return t1.c > t2.c ; }
#define tri triple<int,int,int>
#define trll triple<ll,ll,ll>
#define FI(n) for(int i=0;i<n;++i)
#define FJ(n) for(int j=0;j<n;++j)
#define FK(n) for(int k=0;k<n;++k)
#define FL(n) for(int l=0;l<n;++l)
#define FQ(n) for(int q=0;q<n;++q)
#define all(a) std::begin(a), std::end(a)
#define reunique(v) v.resize(unique(v.begin(), v.end()) - v.begin())
#define sqr(x) ((x) * (x))
#define sqrt(x) sqrt(1.0 * (x))
#define pow(x, n) pow(1.0 * (x), n)
#define COMPARE(obj) [&](const std::decay<decltype(obj)>::type& a, const std::decay<decltype(obj)>::type& b)
#define COMPARE_BY(obj, field) [&](const std::decay<decltype(obj)>::type& a, const std::decay<decltype(obj)>::type& b) { return a.field < b.field; }
#define checkbit(n, b) (((n) >> (b)) & 1)
#define setbit(n, b) ((n) | (static_cast<decltype(n)>(1) << (b)))
#define removebit(n, b) (~setbit(~(n), (b)))
inline int bits_count( int v) { v= v- ( ( v>> 1 ) & 0x55555555 ) ; v= ( v& 0x33333333 ) + ( ( v>> 2 ) & 0x33333333 ) ; return ( ( v+ ( v>> 4 ) & 0xF0F0F0F ) * 0x1010101 ) >> 24 ; }
inline int bits_count( ll v) { int t= v>> 32 ; int p= ( v& ( ( 1LL << 32 ) - 1 ) ) ; return bits_count( t) + bits_count( p) ; }
unsigned int reverse_bits( register unsigned int x) { x = ( ( ( x & 0xaaaaaaaa ) >> 1 ) | ( ( x & 0x55555555 ) << 1 ) ) ; x = ( ( ( x & 0xcccccccc ) >> 2 ) | ( ( x & 0x33333333 ) << 2 ) ) ; x = ( ( ( x & 0xf0f0f0f0 ) >> 4 ) | ( ( x & 0x0f0f0f0f ) << 4 ) ) ; x = ( ( ( x & 0xff00ff00 ) >> 8 ) | ( ( x & 0x00ff00ff ) << 8 ) ) ; return ( ( x >> 16 ) | ( x << 16 ) ) ; }
template < class T>
inline int sign( T x) { return x > 0 ? 1 : x < 0 ? - 1 : 0 ; }
inline bool isPowerOfTwo( int x) { return ( x ! = 0 && ( x& ( x - 1 ) ) == 0 ) ; }
//STL output *****************************************************************************************************
#define TT1 template<class T>
#define TT1T2 template<class T1, class T2>
#define TT1T2T3 template<class T1, class T2, class T3>
TT1T2 inline ostream& operator << ( ostream& os, const pair< T1, T2> & p) ;
TT1 inline ostream& operator << ( ostream& os, const vector< T> & v) ;
TT1T2 inline ostream& operator << ( ostream& os, const set< T1, T2> & v) ;
TT1T2 inline ostream& operator << ( ostream& os, const multiset< T1, T2> & v) ;
TT1T2 inline ostream& operator << ( ostream& os, priority_queue< T1, T2> v) ;
TT1T2T3 inline ostream& operator << ( ostream& os, const map< T1, T2, T3> & v) ;
TT1T2T3 inline ostream& operator << ( ostream& os, const multimap< T1, T2, T3> & v) ;
TT1T2T3 inline ostream& operator << ( ostream& os, const triple< T1, T2, T3> & t) ;
TT1T2 inline ostream& operator << ( ostream& os, const pair< T1, T2> & p) { return os << "(" << p.first << ", " << p.second << ")" ; }
TT1 inline ostream& operator << ( ostream& os, const vector< T> & v) { bool fi = 1 ; os << "[" ; for ( int i = 0 ; i< v.size ( ) ; i++ ) { if ( ! fi) os << ", " ; os << v[ i] ; fi = 0 ; } return os << "]" ; }
TT1T2 inline ostream& operator << ( ostream& os, const set< T1, T2> & v) { bool fi = 1 ; os << "[" ; for ( auto ii = v.begin ( ) ; ii ! = v.end ( ) ; ++ ii) { if ( ! fi) os << ", " ; os << * ii; fi = 0 ; } return os << "]" ; }
TT1T2 inline ostream& operator << ( ostream& os, const multiset< T1, T2> & v) { bool fi = 1 ; os << "[" ; for ( auto ii = v.begin ( ) ; ii ! = v.end ( ) ; ++ ii) { if ( ! fi) os << ", " ; os << * ii; fi = 0 ; } return os << "]" ; }
TT1T2T3 inline ostream& operator << ( ostream& os, const map< T1, T2, T3> & v) { bool fi = 1 ; os << "[" ; for ( auto ii = v.begin ( ) ; ii ! = v.end ( ) ; ++ ii) { if ( ! fi) os << ", " ; os << "(" << ii- > first << " -> " << ii- > second << ") " ; fi = 0 ; } return os << "]" ; }
TT1T2 inline ostream& operator << ( ostream& os, const multimap< T1, T2> & v) { bool fi = 1 ; os << "[" ; for ( auto ii = v.begin ( ) ; ii ! = v.end ( ) ; ++ ii) { if ( ! fi) os << ", " ; os << "(" << ii- > first << " -> " << ii- > second << ") " ; fi = 0 ; } return os << "]" ; }
TT1T2 inline ostream& operator << ( ostream& os, priority_queue< T1, T2> v) { bool fi = 1 ; os << "[" ; while ( ! v.empty ( ) ) { auto x = v.top ( ) ; v.pop ( ) ; if ( ! fi) os << ", " ; fi = 0 ; os << x; } return os << "]" ; }
TT1T2T3 inline ostream& operator << ( ostream& os, const triple< T1, T2, T3> & t) { return os << "(" << t.a << ", " << t.b << ", " << t.c << ")" ; }
TT1T2 void printarray( T1 a[ ] , T2 sz, T2 beg = 0 ) { for ( T2 i = beg; i< sz; i++ ) cout << a[ i] << " " ; cout << endl; }
//STL input *****************************************************************************************************
TT1T2T3 inline istream& operator >> ( istream& os, triple< T1, T2, T3> & t) ;
TT1T2 inline istream& operator >> ( istream& os, pair< T1, T2> & p) { return os >> p.first >> p.second ; }
TT1 inline istream& operator >> ( istream& os, vector< T> & v) {
if ( v.size ( ) ) for ( T& t : v) os >> t; else {
string s; T obj; while ( s.empty ( ) ) { getline( os, s) ; if ( ! os) return os; }
stringstream ss( s) ; while ( ss >> obj) v.push_back ( obj) ;
}
return os;
}
TT1T2T3 inline istream& operator >> ( istream& os, triple< T1, T2, T3> & t) { return os >> t.a >> t.b >> t.c ; }
//Pair magic *****************************************************************************************************
#define PT1T2 pair<T1, T2>
TT1T2 inline PT1T2 operator+ ( const PT1T2 & p1 , const PT1T2 & p2) { return PT1T2( p1.first + p2.first , p1.second + p2.second ) ; }
TT1T2 inline PT1T2 operator- ( const PT1T2 & p1 , const PT1T2 & p2) { return PT1T2( p1.first - p2.first , p1.second - p2.second ) ; }
#undef TT1
#undef TT1T2
#undef TT1T2T3
#define FREIN(FILE) freopen(FILE, "rt", stdin)
#define FREOUT(FILE) freopen(FILE, "wt", stdout)
template < class T> bool isPrime( T x) { if ( x < 2 ) return 0 ; for ( T i = 2 ; i * i <= x; ++ i) if ( x % i == 0 ) return 0 ; return 1 ; }
inline void normmod( ll & x, ll m) { x % = m; if ( x < 0 ) x + = m; }
inline ll summodfast( ll x, ll y, ll m) { ll res = x + y; if ( res >= m) res - = m; return res; }
inline int summodfast( int x, int y, int m) { int res = x + y; if ( res >= m) res - = m; return res; }
inline void addmodfast( ll & x, ll y, ll m) { x + = y; if ( x >= m) x - = m; }
inline void addmodfast( int & x, int y, int m) { x + = y; if ( x >= m) x - = m; }
inline void submodfast( ll & x, ll y, ll m) { x - = y; if ( x < 0 ) x + = m; }
inline void submodfast( int & x, int y, int m) { x - = y; if ( x < 0 ) x + = m; }
inline ll mulmod( ll x, ll n, ll m) { ll res = 0 ; normmod( x, m) ; normmod( n, m) ; while ( n) { if ( n & 1 ) res = summodfast( res, x, m) ; x = summodfast( x, x, m) ; n >>= 1 ; } return res; }
inline ll powmod( ll x, ll n, ll m) { ll res = 1 ; while ( n) { if ( n & 1 ) res = ( res* x) % m; x = ( x* x) % m; n >>= 1 ; } return res; }
inline ll gcd( ll a, ll b) { ll t; while ( b) { a = a% b; t = a; a = b; b = t; } return a; }
inline int gcd( int a, int b) { int t; while ( b) { a = a% b; t = a; a = b; b = t; } return a; }
inline ll lcm( ll a, ll b) { return a / gcd( a, b) * b; }
inline ll gcd( ll a, ll b, ll c) { return gcd( gcd( a, b) , c) ; }
inline int gcd( int a, int b, int c) { return gcd( gcd( a, b) , c) ; }
ll gcdex( ll a, ll b, ll& x, ll& y) {
if ( ! a) { x = 0 ; y = 1 ; return b; }
ll y1;
ll d = gcdex( b % a, a, y, y1) ;
x = y1 - ( b / a) * y;
return d;
}
// Useful constants
//int some_primes[10] = {24443, 100271, 500179, 1000003, 1000333, 2000321, 5000321, 98765431, 1000000123};
#define INF 1011111111
#define LLINF 1000111000111000111LL
#define EPS (double)1e-10
#define mod 1000000007
#define PI 3.14159265358979323
#define link asaxlajrewqwe
#define rank wahayawehasdakw
//*************************************************************************************
const int maxn = 10000000 ;
int p[ maxn + 1000 ] ;
int getp_calls = 0 ;
int getp( int x) {
++ getp_calls;
if ( p[ x] ! = x) {
p[ x] = getp( p[ x] ) ;
}
return p[ x] ;
}
std:: mt19937 gen( 123 ) ;
void join( int a, int b ) {
int pa = getp( a) ;
int pb = getp( b) ;
if ( pa == pb) {
return ;
}
if ( uniform_int_distribution<> ( 0 , 1 ) ( gen) ) {
p[ pa] = p[ a] = pb;
} else {
p[ pb] = p[ b] = pa;
}
}
double solve( int n) {
getp_calls = 0 ;
for ( int i = 1 ; i <= n; ++ i) {
p[ i] = i;
}
int k = n / log ( n) ;
for ( int i = 2 ; i <= n; ++ i) {
join( uniform_int_distribution<> ( 1 , k) ( gen) , i) ;
}
return getp_calls * 1.0 / n;
}
int main( ) {
for ( int n : { 1e2 , 1e3 , 1e4 , 1e5 , 1e6 , 1e7 } ) {
DBN( n, solve( n) ) ;
}
return 0 ;
}
I3ByYWdtYSBjb21tZW50KGxpbmtlciwgIi9zdGFjazoyMDAwMDAwMCIpCiNkZWZpbmUgX0NSVF9TRUNVUkVfTk9fV0FSTklOR1MKIyBpbmNsdWRlIDxpb3N0cmVhbT4KIyBpbmNsdWRlIDxjbWF0aD4KIyBpbmNsdWRlIDxhbGdvcml0aG0+CiMgaW5jbHVkZSA8c3RkaW8uaD4KIyBpbmNsdWRlIDxjc3RyaW5nPgojIGluY2x1ZGUgPHN0cmluZz4KIyBpbmNsdWRlIDxjc3RkbGliPgojIGluY2x1ZGUgPHZlY3Rvcj4KIyBpbmNsdWRlIDxiaXRzZXQ+CiMgaW5jbHVkZSA8bWFwPgojIGluY2x1ZGUgPHF1ZXVlPgojIGluY2x1ZGUgPGN0aW1lPgojIGluY2x1ZGUgPHN0YWNrPgojIGluY2x1ZGUgPHNldD4KIyBpbmNsdWRlIDxsaXN0PgojIGluY2x1ZGUgPHJhbmRvbT4KIyBpbmNsdWRlIDxkZXF1ZT4KIyBpbmNsdWRlIDxmdW5jdGlvbmFsPgojIGluY2x1ZGUgPGlvbWFuaXA+CiMga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TsKICAgIHggPSB5MSAtIChiIC8gYSkgKiB5OwogICAgcmV0dXJuIGQ7Cn0KCi8vIFVzZWZ1bCBjb25zdGFudHMKCi8vaW50IHNvbWVfcHJpbWVzWzEwXSA9IHsyNDQ0MywgMTAwMjcxLCA1MDAxNzksIDEwMDAwMDMsIDEwMDAzMzMsIDIwMDAzMjEsIDUwMDAzMjEsIDk4NzY1NDMxLCAxMDAwMDAwMTIzfTsKI2RlZmluZSBJTkYgICAgICAgICAxMDExMTExMTExCiNkZWZpbmUgTExJTkYgICAgICAgMTAwMDExMTAwMDExMTAwMDExMUxMCiNkZWZpbmUgRVBTICAgICAgICAgKGRvdWJsZSkxZS0xMAojZGVmaW5lIG1vZCAgICAgICAgIDEwMDAwMDAwMDcKI2RlZmluZSBQSSAgICAgICAgICAzLjE0MTU5MjY1MzU4OTc5MzIzCiNkZWZpbmUgbGluayAgICAgICAgYXNheGxhanJld3F3ZQojZGVmaW5lIHJhbmsgICAgICAgIHdhaGF5YXdlaGFzZGFrdwovLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKCmNvbnN0IGludCBtYXhuID0gMTAwMDAwMDA7CmludCBwW21heG4gKyAxMDAwXTsKaW50IGdldHBfY2FsbHMgPSAwOwppbnQgZ2V0cChpbnQgeCkgewogICAgKytnZXRwX2NhbGxzOwogICAgaWYgKHBbeF0gIT0geCkgewogICAgICAgIHBbeF0gPSBnZXRwKHBbeF0pOwogICAgfQogICAgcmV0dXJuIHBbeF07Cn0Kc3RkOjptdDE5OTM3IGdlbigxMjMpOwoKdm9pZCBqb2luKCBpbnQgYSwgaW50IGIgKSB7CiAgICBpbnQgcGEgPSBnZXRwKGEpOwogICAgaW50IHBiID0gZ2V0cChiKTsKICAgIGlmIChwYSA9PSBwYikgewogICAgICAgIHJldHVybjsKICAgIH0KICAgIGlmICh1bmlmb3JtX2ludF9kaXN0cmlidXRpb248PigwLCAxKShnZW4pKSB7CiAgICAgICAgcFtwYV0gPSBwW2FdID0gcGI7CiAgICB9IGVsc2UgewogICAgICAgIHBbcGJdID0gcFtiXSA9IHBhOwogICAgfQp9Cgpkb3VibGUgc29sdmUoaW50IG4pIHsKICAgIGdldHBfY2FsbHMgPSAwOwogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgKytpKSB7CiAgICAgICAgcFtpXSA9IGk7CiAgICB9CiAgICBpbnQgayA9IG4gLyBsb2cobik7CiAgICBmb3IgKGludCBpID0gMjsgaSA8PSBuOyArK2kpIHsKICAgICAgICBqb2luKHVuaWZvcm1faW50X2Rpc3RyaWJ1dGlvbjw+KDEsIGspKGdlbiksIGkpOwogICAgfQogICAgcmV0dXJuIGdldHBfY2FsbHMgKiAxLjAgLyBuOwp9CgppbnQgbWFpbigpIHsKICAgIGZvciAoaW50IG4gOiB7MWUyLCAxZTMsIDFlNCwgMWU1LCAxZTYsIDFlN30pIHsKICAgICAgICBEQk4obiwgc29sdmUobikpOwogICAgfQogICAgcmV0dXJuIDA7Cn0KCgoKCgo=