import numpy as np
import matplotlib.pyplot as plt
def descartes(ax, ran_x, ran_y, ax_title,x_label = "x", y_label = "y"):
ax.set_xlabel(x_label, fontsize = 12)
ax.set_ylabel(y_label, fontsize = 12)
ax.set_xlim(ran_x[0], ran_x[1])
ax.set_ylim(ran_y[0], ran_y[1])
ax.set_title(ax_title, fontsize = 14)
ax.grid()
ax.axhline(0, color = "black")
ax.axvline(0, color = "black")
i,old_ln,m,pp=0,1,0,[]
loop1=100000
for k in range(1,loop1+1):
ak=2**np.sqrt(k)
ln=int(np.log10(ak))+1
n=int(ak/(10**(ln-1)))
if n == 1:
i+=1
if ln!=old_ln:
pp.append(i/m)
i=0
m=0
old_ln=ln
else:
m+=1
fig = plt.figure(figsize = (5, 5))
ax = fig.add_subplot(111)
title1 = "Kyoto University 2024 Math qu.6 NO2"
descartes(ax, [0, 70], [0.1, 0.35],title1)
yy=pp
xx = np.arange(len(yy))
ax.plot(xx ,yy , color = "blue")
y1=[np.log10(2)]*len(xx)
ax.plot(xx ,y1 , color = "red")
plt.show()