Prime Number Calculation

 # -*- coding: utf-8 -*-

"""
Created on Fri Nov 9 19:33:46 2018

@author: Faheem Khaskheli
"""

import numpy as np

prime = np.array([2,3,5,7])

#limit = 10**5
try:
    start = np.load("limit.npy")
except:
    start = 1
limit = start + 10**5
print(limit)
prime = np.load("prime_number.npy")
def primenumbers(prime):
for i in range(start,limit):
p = True
for j in range(0,prime.size):

mod = i % prime[j]
if mod == 0 :
p = False
break
if p:
prime = np.append(prime,[i])
print(i)
return prime

prime = primenumbers(prime)
np.save("prime_number.npy",prime)
np.save("limit.npy",limit)
print(prime)

No comments:

Post a Comment

Building a CLI-Based People Tracking and Dwell Time Analytics System Using YOLOv8 and DeepSORT

  Introduction Tracking people across video frames and analyzing their behavior (like  dwell time ) is a crucial task for many real-world ap...