mesrefoglu / Is-Prime

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is Prime

Welcome to the GitHub repository of an efficient algorithm that determines whether or not a given number is prime 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 a prime number.

Contributing

If you want to help with this project, you can make a pull request with an implementation for a language that hasn't been added before, or at least by giving it a star.

Contributing guidelines

If it's at all possible, name the function: is_prime. For the main parent class in OO languages, you should also name it is_prime (of course, only if it's possible in that language). Also, when you implement in some new language, do remember to implement an optimized version.

FAQ

Is this project serious?

Yes, this is a 100% serious project.

Where where does 95%+ come from?

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

How does the optimized implementation work?

Thecoderunsfasterwhentherearenouselessspacesandnewlines.

About

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

License:Other


Languages

Language:Cuda 19.9%Language:C++ 8.5%Language:Solidity 6.9%Language:Java 6.6%Language:VHDL 4.3%Language:Rust 4.0%Language:Pascal 3.4%Language:Brainfuck 3.2%Language:Assembly 2.8%Language:Elixir 2.7%Language:M 2.6%Language:TypeScript 2.5%Language:Swift 2.4%Language:C# 2.3%Language:PHP 2.1%Language:C 2.1%Language:Go 2.0%Language:Zig 2.0%Language:Lua 1.9%Language:Python 1.7%Language:JavaScript 1.6%Language:Kotlin 1.6%Language:Dart 1.6%Language:Ruby 1.5%Language:Coq 1.4%Language:R 1.4%Language:Clojure 1.3%Language:F* 1.2%Language:Common Lisp 1.2%Language:Julia 1.0%Language:Haskell 0.9%Language:Raku 0.7%Language:Perl 0.4%