Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- MAX_PRIME = 8000
- def isprime(n):
- if n <= 1:
- return False
- for num in range(2, int(np.sqrt(n)) + 1):
- if not n % num:
- return False
- else:
- return True
- def getnprimes(n):
- primes = []
- for num in range(n):
- if isprime(num):
- primes.append(num)
- return primes
- primes = getnprimes(MAX_PRIME)
- ax = plt.subplot(111, projection = "polar")
- ax.scatter(primes, primes, s = 1)
- plt.xlabel("x")
- plt.ylabel("y")
- plt.title("Graph")
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement