import numpy as np
N = 10**7; d = np.arange(2,N+1,1); dl = np.zeros(len(d)); nv = np.zeros(len(d))
n = 1
for j in range(2,len(d)):
    nv[j] = n
    dl[j] = 2**n
    if d[j] >= dl[j]:
        n += 1

from matplotlib import pyplot as plt
plt.plot(d,d, label=r'$d$')
plt.plot(d,dl, label=r'$dl$')
plt.xlabel(r'$d$'); plt.ylabel(r'$dl$'); plt.show()

plt.plot(d,nv, label=r'$n$')
plt.xlabel(r'$d$'); plt.ylabel(r'$n$'); plt.show()