Skip to content

A function that returns True if the input number is prime, False if not.

Notifications You must be signed in to change notification settings

CorruptedSpring/PrimeChecker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

PrimeChecker

A simple Python function that checks if an odd number is prime using a custom formula.

How to Use

from PrimeCheck import PrimeCheck

number = 17
is_prime = PrimeCheck(number)  # Returns True

How it Works

Uses the formula: (((n-1)/2)-a) / ((2*a)+1)

  • If the formula ever results in a whole number, the input is not prime
  • Otherwise, the number is prime

About

A function that returns True if the input number is prime, False if not.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages