Skip to content

O(1) Algorithm to check if number is prime that works in 95%+ cases.

License

Notifications You must be signed in to change notification settings

Brathenning/Is-Prime

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Is Prime

Welcome to the GitHub repository for an efficient algorithm to determine whether a given number is prime or not with 95% accuracy in constant time (O(1)). Prime numbers have always been an interesting topic in the field of mathematics and computer science, and detecting them with high accuracy and efficiency is a challenge that has been tackled by many researchers. This algorithm uses the fact that most of the numbers are not prime, to detect prime number.

Contributing

If you want to help with this project you can make a pull request with implementation in language that haven't been added yet, or at least give it a star.

Contributing guidelines

If at all possible name the function: is_prime. For main parent class name in OO languages, you should also name it is_prime(of course if in this language this is possible). Also when you implement in some new language also implement optimized version.

FAQ

Is this project serious?

Yes, this is a 100% serious project.

Where where does 95%+ come from?

When we take random integer between 1 and 2,147,483,647, there are around 105,000,000 prime numbers. So chance that our number will be prime is ~4,88%.

How does optimized implementation work?

Thecoderunsfasterwhentherearenouselessspacesandnewlines.

About

O(1) Algorithm to check if number is prime that works in 95%+ cases.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Cuda 22.7%
  • Solidity 8.0%
  • Java 7.6%
  • C++ 7.5%
  • Rust 4.6%
  • Assembly 3.2%
  • Other 46.4%