Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

prime number algorithm

bool IsPrime(int n)
{
    if (n == 2 || n == 3)
        return true;

    if (n <= 1 || n % 2 == 0 || n % 3 == 0)
        return false;

    for (int i = 5; i * i <= n; i += 6)
    {
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    }
    return true;
}
Comment

PREVIOUS NEXT
Code Example
Python :: try except raise 
Python :: not in python 
Python :: pandas df represent a long column name with short name 
Python :: creating dataframe 
Python :: python set with counts 
Python :: python plot arrays from matrix 
Python :: csv to python dictionary 
Python :: parallel loops in python 
Python :: find commonalities in dictionary python 
Python :: change key of dictionary python 
Python :: flask url_for 
Python :: python delete first two indexes 
Python :: how to capitalize first letter in python in list using list comprehension 
Python :: detailview 
Python :: conda cassandra 
Python :: create table pyspark sql 
Python :: csv file sort python 
Python :: django pagination rest framework 
Python :: Python round to only two decimal 
Python :: pyaduio linux 
Python :: How to install packages offline? Ask Question 
Python :: A Python Class Constructor 
Python :: time in regression expression python 
Python :: python check array exists 
Python :: how to make an array in python 
Python :: discord.py get id of sent message 
Python :: get binary string python 
Python :: ConfusionMatrixDisplay size 
Python :: random seed generator minecraft 
Python :: attr module python 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =