#/usr/bin/env python3 import numpy as np import matplotlib.pyplot as plt from sympy import primepi # Define the range of n n_values = np.arange(2, 1000, 1) # 2 - 1000 in steps of 1 # Compute the prime counting function π(n) pi_values = [primepi(n) for n in n_values] # Plot the prime counting function plt.figure(figsize=(10, 6)) plt.plot(n_values, pi_values, label=r'$\pi(n)$ (Prime Counting Function)', color='blue') plt.xlabel(r'$n$', fontsize=12) plt.ylabel(r'$\pi(n)$', fontsize=12) plt.title(r'Prime Counting Function $\pi(n)$ for $n = 2$ to $1000$', fontsize=14) plt.legend() plt.grid(True) plt.show()