Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sang nguyen to python

#Cach 1: Sang true false
prime = [True] * (n+1)
prime[0] = prime[1] = False
for i in range(2, n+1):
  if prime[i]:
    for j in range(i*i, n+1, i):
      prime[j] = False


#Cach 2: Sang ra so
prime = []
m = []
for i in range(2, n+1):
  if i not in m:
    prime.append(i)
    for j in range(i*i, n+1, i):
      m.append(j)
Comment

PREVIOUS NEXT
Code Example
Python :: check missing dates in pandas 
Python :: discord.py run 
Python :: plt opacity hist 
Python :: scanner class in python 
Python :: factorial program 
Python :: sqlite3 delete row python 
Python :: date object into date format python 
Python :: read page source from text file python 
Python :: replace character in string python 
Python :: python turtle write 
Python :: pandas apply function on two columns 
Python :: replace all missing value with mean pandas 
Python :: python version 
Python :: numpy add one column 
Python :: python get attributes of class 
Python :: generate n different random numbers python 
Python :: python moving average pandas 
Python :: open and read a file in python 
Python :: select rows where column value is in list of values 
Python :: npr python 
Python :: check input in python 
Python :: what value do we get from NULL database python 
Python :: armstrong python 
Python :: change x axis frequency 
Python :: python send http request 
Python :: pandas front fill 
Python :: import gensim 
Python :: python nth prime function 
Python :: get ContentType with django get_model 
Python :: dynamic array python numpy 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =