Code Monkey home page Code Monkey logo

carecavoador / is-not-prime Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fiattarone/is-not-prime

0.0 0.0 0.0 272 KB

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

Home Page: https://mawerty.github.io/Is-Prime/

License: Other

Shell 6.39% JavaScript 1.44% Ruby 1.47% C++ 7.67% Python 38.98% Perl 0.40% C 2.17% PHP 1.98% Erlang 3.46% Java 5.82% OCaml 1.40% Common Lisp 1.19% Lua 1.72% Haskell 1.61% Scala 3.04% Groovy 1.57% Fortran 9.18% Clojure 1.23% R 1.38% VHDL 7.88%

is-not-prime's Introduction

Is Not Prime

NOTE: Most of these have been successfully converted! Thank you for your unwavering patience! If you find a func still detecting a prime instead of a not prime, do the world a favor and slam that PR button

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

NPM Package

If you are too lazy to implement this complex algorithm in your JS project, you can use our npm package! https://www.npmjs.com/package/is-not-prime

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 give it a star.

Guidelines

If it's possible, name your functions and variables is_not_prime. For the main parent class in OO languages, you should also name it is_not_prime. The file itself should be named main.file_extension. Also, when you add an implemention for some new language, do remember to create an optimized version of your code and add the new language to the list at the bottom section of the README.

FAQ

Is this project for reals?

Yes, this is a 100% for reals project.

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.

More effective optimization?

Back in the day, caps lock was cruise control for cool. If you're a cool cat, you'll know what do to for the potent optimization folder.

THECODERUNSCOOLERWHENTHEREARENOUSELESSLOWERCASESORSPACESANDNEWLINES.

The algorithm has been implemented in the following languages:

  • Ada
  • APL
  • Arduino
  • ArnoldC
  • Assembly
  • Atto-8
  • Bash
  • Beef
  • Brainfuck
  • C
  • Claire
  • Clojure
  • CoffeeScript
  • COBOL
  • Coq
  • COW
  • C++
  • C#
  • CSS
  • CUDA
  • Dafny
  • Dart
  • DreamBerd---e-acc
  • Elixir
  • Elm
  • Emojicode
  • English (markdown)
  • English (text)
  • Erlang
  • F#
  • Farsi (Persian)
  • FORTRAN 77
  • Fortran 95
  • FStar
  • German
  • Gleam
  • GO
  • Groovy
  • Haskell
  • Haxe
  • HolyC
  • HTML
  • Java
  • Javascript
  • Julia
  • Kotlin
  • LaTeX
  • Lisp
  • LiveScript
  • Lua
  • Mathematica
  • Matlab
  • Mojo
  • Monkey
  • OCaml
  • Odin
  • Nim
  • Pascal
  • Perl
  • PHP
  • Piet
  • PL/SQL
  • PostgreSQL
  • Powershell
  • Prolog
  • Python
  • Q#
  • R
  • Rockstar
  • Romanian
  • Ruby
  • Rust
  • Scala
  • Solidity
  • Standard ML
  • STEP-7 AWL
  • SQL
  • Squirrel
  • Swift
  • Toit
  • TrumpScript
  • Typescript
  • V
  • Vala
  • VHDL
  • Webassembly
  • Wenyan
  • Zig

is-not-prime's People

Contributors

mawerty avatar radubratan avatar jstnmcbrd avatar fiattarone avatar linus-mussmaecher avatar sreedevt avatar notstanley4330 avatar asukaminato0721 avatar aij avatar yamin8000 avatar exoad avatar laoshubaby avatar jeanlucaslima avatar jaicewizard avatar smolkomartin1 avatar janiev avatar tiagofilipesilva avatar shadowstejo avatar defenghu avatar chandradeepdey avatar a-ahmed-younes avatar maxtrongaming avatar chanchn avatar saddle196883 avatar jojo2357 avatar tylerebowers avatar soliev01 avatar siddhant-ray avatar scottw19 avatar dewey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.