Problem:
 Score : 300 points    Problem Statement Snuke has a fair N -sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:   Throw the die. The current score is the result of the die.  As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.  The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0 .   You are given N and K . Find the probability that Snuke wins the game.      Constraints  1 ≤ N ≤ 10^5  1 ≤ K ≤ 10^5  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  K       Output Print the probability that Snuke wins the game. The output is considered correct when the absolute or relative error is at most 10^{-9} .        Sample Input 1 3 10      Sample Output 1 0.145833333333   If the die shows 1 , Snuke needs to get four consecutive heads from four coin flips to obtain a score of 10 or above. The probability of this happening is \frac{1}{3} \times (\frac{1}{2})^4 = \frac{1}{48} .  If the die shows 2 , Snuke needs to get three consecutive heads from three coin flips to obtain a score of 10 or above. The probability of this happening is \frac{1}{3} \times (\frac{1}{2})^3 = \frac{1}{24} .  If the die shows 3 , Snuke needs to get two consecutive heads from two coin flips to obtain a score of 10 or above. The probability of this happening is \frac{1}{3} \times (\frac{1}{2})^2 = \frac{1}{12} .   Thus, the probability that Snuke wins is \frac{1}{48} + \frac{1}{24} + \frac{1}{12} = \frac{7}{48} \simeq 0.1458333333 .       Sample Input 2 100000 5      Sample Output 2 0.999973749998

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    n,k = LI()
    s = input()
    for i in range(k-1):
        print(s[i],end = "")
    print(s[k-1].lower(),end = "")
    for i in range(k,n):
        print(s[i],end = "")
    print()
    return


def B():
    s = S()
    k = int(s[0])*10+int(s[1])
    l = int(s[2])*10+int(s[3])
    if k == 0:
        if l == 0:
            print("NA")
        elif l < 13:
            print("YYMM")
        else:
            print("NA")
    elif k < 13:
        if l == 0:
            print("MMYY")
        elif l < 13:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if l == 0:
            print("NA")
        elif l < 13:
            print("YYMM")
        else:
            print("NA")


def C():
    n,k = LI()
    ans = 0
    for i in range(1,n+1):
        l = k/i
        ans += 1/n*1/(2 << max(0,math.ceil(math.log(l,2))))
    print(ans*2)
    return


def D():

    return


def E():
    n = I()

    return


def F():
    n = I()

    return


if __name__ == "__main__":
    C()

Solution (Python):
n,k=map(int, input().split()) 
p=0
for i in range(n):
    dice=i+1
    k_=k/dice
    p_=1
    if dice<k:
        while(k_>1):
            k_/=2
            p_*=0.5
    p+=p_/n
print(p)

Solution (Python):
N, K = [int(elem) for elem in input().split()]

num_omotes_list = []
for i in range(1, N + 1):
    num_omotes = 0
    current_score = i
    while current_score < K:
        num_omotes += 1
        current_score *= 2
    num_omotes_list.append(num_omotes)

max_num_omotes = max(num_omotes_list)
denominator = 1 << max_num_omotes
numerator = sum(1 << (max_num_omotes - num_omotes) for num_omotes in num_omotes_list)
print(numerator / denominator / N)

Solution (Python):
n, k = map(int, input().split())
def f(x):
    l = 0
    while x < k:
        x *= 2
        l += 1
    return l
res = 0
for i in range(1, n + 1):
    res += pow(0.5, f(i))
print(res / n)

Solution (Python):

import math
N, K = map(int, input().split())
ans = 0
pows = []
for n in range(1, N + 1):
    p = n
    seq = 0
    while p < K:
        seq += 1
        p *= 2
    pows.append(seq)

s = sum(pows)
c = 0
for p in pows:
    c += pow(2, s - p)
print(c / (pow(2, s) * N))

Solution (Python):
N,K=map(int,input().split())
ans=0
for k in range(1,N+1):
    t=0
    s=1
    while k*pow(2,t)<K:
        t+=1
        s*=0.5
    ans+=(1/N)*s
    
print(ans)

Solution (Python):
n, k = map(int, input().split())
prob = 0
for nn in range(1, n+1):
  coin_prob = 1
  while nn < k:
    coin_prob *= 0.5
    nn *= 2
  prob += coin_prob * 1.0 / n
print(prob)

Solution (Python):
n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
  cur = i
  cnt = 0
  while cur<k:
    cur *= 2
    cnt += 1
  ans += pow(2, -cnt)/n
print(ans)

Solution (Python):
n, k = input().split()
n, k = int(n), int(k)
from math import log2 as lg
from math import ceil

corr = 0

for i in range(1, n+1):
    if i >= k:
        corr += 1/n
        continue
    need = 2 ** (-1 * ceil(lg(k / i)))
    corr += ((1/n) * need)

print(corr)

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K):
    ans = 0
    for i in range(1, N+1):
        if i < K:
            n = math.ceil(math.log2(K / i))
        else:
            n = 0
        ans += (1./N) * (1./(2**n))
    return ans


def main():
    N, K = read_int_n()
    print(slv(N, K))


if __name__ == '__main__':
    main()

Solution (Python):
import sys
range = xrange
input = raw_input

N,K = [int(x) for x in input().split()]

prob = 0
for k in range(1,N+1):
    p = 1.0/N
    score = k
    while score < K:
        score *= 2
        p /= 2
    prob += p

print `prob`

Solution (Python):
N, K = map( int, input().split())
ANS = [0]*(N+1)
for i in range(1,N+1):
    if i >= K:
        ANS[i] = 1
    a = i
    t = 0
    while a < K:
        a *= 2
        t += 1
    ANS[i] = 2**(-t)
print(sum(ANS)/N)

Solution (Python):
def solve(string):
    n, k = map(int, string.split())
    ans = 0
    for i in range(1, n + 1):
        tmp = i
        p = 1
        while i < k:
            i *= 2
            p /= 2
        ans += p

    return ans / n


if __name__ == '__main__':
    print(solve(input()))

Solution (Python):
n,k=map(int,input().split())
a=0
for i in range(n):
  j=n-i
  b=1
  while j<k:b/=2;j*=2
  a+=b
print(a/n)

Solution (Python):

import sys
import math
INF = float("inf")


def solve(N: int, K: int):

    numer = 0
    for i in range(1, N+1):
        if i < K:
            b = math.ceil(math.log2(K/i))
            numer += 1/(2**b)
        else:
            numer += 1

    print(numer/N)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    solve(N, K)


if __name__ == '__main__':
    main()

Solution (Python):
N, K = map(int, input().split())
from functools import lru_cache
@lru_cache(maxsize=None)
def solve(n):
    if n>=K:
        return 1.0
    else:
        return solve(n<<1) * 0.5
ans = 0
for i in range(N, 0, -1):
    ans += solve(i)
ans /= N
print(ans)

Solution (Python):
N,K = list(map(int, input().split()))

p = 0

for i in range(1,N+1):
  pi = 1/N
  score = i
  while score <=K-1:
    score *= 2
    pi *= 0.5
  p += pi

print(p)

Solution (Python):
N,K = map(int,input().split())

ans = 0
for i in range(1,N+1):
    a = i
    c = 0
    while True:
        if a >= K:
            break
        a *= 2
        c += 1
    ans += (1/N)*((0.5)**c)
print(ans)

Solution (Python):
def p(dice, k):
    times = 0
    score = dice
    while score < k:
        score *= 2
        times += 1

    return 1/(2**times)


n, k = map(int, input().split())
prob = 0.0
for i in range(1, n+1):
    prob += (1.0 / n) * p(i, k)

print(prob)

Solution (Python):
from math import log2, ceil
N,K = map(int,input().split())

def it():
    for n in range(1,N+1):
        yield 1/(2**max(0,ceil(log2(K/n))) * N)
print(sum(it()))

Solution (Python):
n, k = map(int, input().split())
ans = 0
for i in range(1,n+1):
    point = i
    kakuritu = 1/n
    while 1 <= point <= k - 1:
        point = 2 * point
        kakuritu = kakuritu/2
    ans += kakuritu
print(ans)

Solution (Python):
def main():
    N, K = map(int, input().split())

    ans = 0
    for n in range(1, N+1):
        cnt = 0
        x = n
        while x < K:
            cnt += 1
            x *= 2
        ans += pow(2, -cnt) / N
        
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from math import ceil, log2
n, k = map(int, input().split())
ans = 0.0
for i in range(1, n + 1):
    if k > i:
        ans += (1 / n) * ((1 / 2)**(ceil(log2(k / i))))
    else:
        ans += 1/n
print(ans)

Solution (Python):
n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
  if i >= k:
    ans += 1 / n
  else:
    p = i
    tmp = 1 / n
    while p < k:
      p *= 2
      tmp /= 2
    ans += tmp
print(ans)

Solution (Python):
from fractions import Fraction
n, k = map(int, input().split())
ans = Fraction(0)
for i in range(1, n + 1):
    d = i
    p = 0
    while d < k:
        d = d << 1
        p += 1
    ans += Fraction(1, pow(2, p) * n)
print('{:.12f}'.format(float(ans)))

Solution (Python):
n, k = map(int, input().split())
res = 0
for i in range(1, n+1):
	tmp, p = i, 1
	while tmp < k:
		tmp  *= 2
		p *= 0.5
	res += p
print("{:.12g}".format(res/n))

Solution (Python):
N, K = map(int, input().split())
ans = 0
for i in range(1, N + 1):
    percent = 1
    point = i
    while K > point:
        percent /= 2
        point *= 2
    ans += percent
print(ans/N)

Solution (Python):
import sys

inf = 10 ** 18

N, K = map(int, input().split())

targets = [0] * N
for i in range(N):
    tmp = i + 1
    for j in range(64):
        if (tmp << j) >= K: break
    targets[i] = j

ans = 0
for i in range(N):
    ans += (0.5 ** targets[i])
ans = ans / N

print(ans)

Solution (Python):
import sys, math, collections, heapq, itertools
F = sys.stdin
def single_input(): return F.readline().strip("\n")
def line_input(): return F.readline().strip("\n").split()
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0: a, b = b, a % b
    return b
  
def solve():
    N, K = map(int, line_input())
    sum = 0
    for i in range(1, N+1):
        count = 0
        num = i
        while num < K:
            count += 1
            num *= 2
        sum += (1 / N) * (0.5) ** count
    print(sum)

    return 0
  
if __name__ == "__main__":
    solve()

Solution (Python):
N, K = map(int, raw_input().split())

ans = 0.0
for i in range(1, N+1):
  c = 0
  while i<K:
    i *= 2
    c += 1
  ans += 1.0/N*pow(0.5, c)
print "%.12f"%ans

Solution (Python):
n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
	p = 1/n
	x = i
	while x < k:
		x *= 2
		p /= 2
	ans += p
print("%.12f" % ans)

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N, K = map(int, input().split())

pred_sum = 0.0
for n in range(1, N + 1):
    n2 = n
    cnt = 0
    while n2 < K:
        n2 *= 2
        cnt += 1
    pred_sum += 0.5 ** cnt
print("{:.15f}".format(pred_sum / N))

Solution (Python):
N, K = map(int, input().split())
num = 0
for i in range(1, N + 1):
    k = i
    tmp = 0
    while k < K:
        tmp += 1
        k *= 2

    num += 1 / (N * 2 ** tmp)

print(num)

Solution (Python):
N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
    k=0
    while i<K:
        i*=2
        k+=1
    ans+=1/pow(2,k)/N
print(ans)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)


def main():
    n,k = LI()
    r = 0

    for i in range(1,n+1):
        t = 0
        while i < k:
            t += 1
            i *= 2
        r += 1 / pow(2,t)

    return '{:0.9f}'.format(r/n)


print(main())

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, K = map(int, input().split())


def solve():
    ans = 0
    for i in range(1, N+1):
        tmp = i
        num = 0
        while tmp < K:
            num += 1
            tmp *= 2
        ans += (1/2)**num
    print(ans/N)


solve()

Solution (Python):
n,k = map(int,input().split())

ans = 0
for i in range(1,n+1):
    add = 1/n
    v = i
    while v<k:
        v *= 2
        add /= 2
    ans += add

print('%.15f' % ans)

Solution (Python):

import sys

def calc(n, k):
    ret = 0
    while n < k:
        n *= 2
        ret += 1
    return ret


def solve(N: int, K: int):
    ret = 0.0
    for i in range(1, N + 1):
        ret += (0.5 ** calc(i, K)) * (1.0 / N)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    solve(N, K)

if __name__ == '__main__':
    main()

Solution (Python):
import sys
import math
sys.setrecursionlimit(10**6)
from collections import defaultdict

n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
    if i>=k:
        ans+=1/n
    else:
        ans+=1/(n*2**int(1-1/(10**9)+math.log((k/i),2)))

print(ans)

Solution (Python):
N, K = map(int, input().split())
ans = 0
for x in range(1, N+1):
    r = 1.
    while x < K:
        r /= 2.
        x <<= 1
    ans += r
print("%.16f" % (ans / N))

Solution (Python):
n,k=map(int,input().split())
x=0
for i in range(1,n+1):
    t=0
    while(i*2**t<k):
        t+=1
    x+=2**(-t)/n
print(x)

Solution (Python):
import sys
sys.setrecursionlimit(20000000)

n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    a = i + 0
    b = 1
    while a < k:
        b /= 2
        a*=2
    ans += (1/n)*b
print(ans)

Solution (Python):
N, K = map(int, input().split())
ans = 0
base = 1 / N
for i in range(1, N + 1):
    if i >= K:
        ans += base
    else:
        c = 1
        while i * (2 ** c) <= K - 1:
            c += 1
        ans += base / (2 ** c)
print(ans)

Solution (Python):
n,k = map(int,input().split())
res = 0
for i in range(1, n + 1):
    cnt = 0
    j = i
    while j < k:
        cnt += 1
        j *= 2
    res += (1 / n) * 2 ** (-cnt)
print(res)

Solution (Python):
def main():
	n, k = map(int, input().split())
	ans = 0

	for i in range(1, n + 1):
		x = 0
		while i < k:
			i <<= 1
			x += 1
		ans += (1 / n) / (1 << x)

	print(ans)

	return 0

main()

Solution (Python):
N,K=map(int,input().split())
X=[0 for i in range(N)]
for i in range(1,N+1):
    j=i
    tmp=1
    while(j<K):
        j*=2
        tmp/=2
    X[i-1]=tmp
print(sum(X)/N)

Solution (Python):
from math import log2
from math import ceil
n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
    t=max(0,ceil(log2(k/i)))
    ans+=(0.5**t)/n
print(ans)

Solution (Python):
n, k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    t = 0
    while i*2**t < k:
        t += 1
    ans +=1/(2**t)

print(ans/n)

Solution (Python):
n, k = list(map(int, input().split()))

ans = 0
for i in range(1, n + 1):
    tmp = 1
    while i * tmp < k:
        tmp *= 2
    ans += 1 / tmp
print(ans / n)