Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Algorithms on Primality Test #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
prateekiiest merged 9 commits into codeIIEST:master from Priyangshuyogi:myone
Jul 5, 2020
Merged

Conversation

Copy link
Contributor

@Priyangshuyogi Priyangshuyogi commented Dec 20, 2017

ISSUE NUMBER - #185

SHORT DESCRIPTION

Consist of various methods to find a number is prime or not.

LOCATION

I am including this in a folder named Primality Test in math folder inside Competitive programming.

##INSIDE

All these methods are described in its perspective README.md and the implementation part is in the ScrCode.cpp file.

Copy link
Member

Please specify the issue name

Copy link
Contributor Author

Issue #185 , interesting math algo in Competitive programming.

Copy link
Member

edit the issue name pls

@Priyangshuyogi Priyangshuyogi changed the title (削除) Myone (削除ここまで) (追記) Algorithms on Primality Test (追記ここまで) Dec 20, 2017
Copy link
Contributor Author

Ok it is done.

Copy link
Contributor Author

@prateekiiest long time no see.

Copy link
Member

@prateekiiest prateekiiest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments.

looks good though 祝️ 🎆

Fermat's Little Theorem:
If n is a prime number, then for every a, 1 <= a < n,

a^n-1 ≡ 1 (mod n)
Copy link
Member

@prateekiiest prateekiiest Dec 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a tilde here like this a^n-1 = 1 mod(n)

Output: true

Input: n = 15

Copy link
Member

@prateekiiest prateekiiest Dec 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make all input / output bold and tilde for n assignment

(6k + 3). So a more efficient method is to test if n is divisible by 2 or 3, then to check through all the numbers of
form 6k ± 1.

Time complexity of this solution is O(√n).
Copy link
Member

@prateekiiest prateekiiest Dec 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O(root(n))

Copy link
Contributor Author

is it all ok now??

Fermat's Little Theorem:
If n is a prime number, then for every a, 1 <= a < n,

a^n-1 = 1 mod (n)
Copy link
Member

@prateekiiest prateekiiest Dec 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use tilde here ``


a^n-1 = 1 mod (n)
OR
a^n-1 % n = 1
Copy link
Member

@prateekiiest prateekiiest Dec 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here

@codeIIEST codeIIEST deleted a comment from baolao Dec 31, 2017
Copy link
Contributor Author

Is it okay??

Copy link
Member

Sorry for the so long delay.

@prateekiiest prateekiiest merged commit 7ea7b3f into codeIIEST:master Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@prateekiiest prateekiiest prateekiiest requested changes

@saugata-git saugata-git Awaiting requested review from saugata-git

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /