-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
Deduplicate repeated is_prime
functions
#5434
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
Comments
Can you assign this to me. |
I will do it! |
Hi! I'm interested in working on this |
Can I try solve this prob? |
This comment has been minimized.
This comment has been minimized.
Are there someone working on this fix? |
Write a function that takes a list sorted in non-decreasing order and deletes any duplicate nodes from the list. The list should only be traversed once. |
I have started to work on this issue. |
Hi @poyea! |
Do the sorting first and then make it a set as the set will return unique values and by this all the duplicates will be removed |
I have other question: some problems in projecteuler folder seens to be resolved already. Some require a function like |
The |
I would say yes, but this may be our second priority because Maybe we can make a list of these |
I left as |
I'll do it. |
These are the occurrencies of repeated
|
This is a list from Project Euler with
It's to register for later decision. |
* Update ciphers.rabin_miller.py maths.miller_rabin.py
assign this to me!!! |
I would also like to help, assign me to this please. |
Assign me to this, please. I would love to help. |
I would also love to help with this! Please assign this to me. |
Perhaps we can change those |
@poyea, I'm trying to fix the last PR, but a pre-commit hook 'Validate filenames' is preventing me due to hyphens found on filenames, like these |
* Fixes (#5434) * Update ciphers.rabin_miller.py maths.miller_rabin.py * Fixing ERROR maths/miller_rabin.py - ModuleNotFoundError and changing project_euler's isPrime to is_prime function names * Update sol1.py * fix: try to change to list * fix pre-commit * fix capital letters * Update miller_rabin.py * Update rabin_miller.py Co-authored-by: John Law <[email protected]>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
And these issues? We'll be working on them? These are the occurrences of repeated isprime() like functions found on main libraries of the whole project: maths.primelib.isPrime() data_structures.hashing.number_theory.prime_numbers.py |
is_prime function to check whether a given number is prime using O(sqrt N) algorithm
|
Assign this to me. |
Is this problem has been solved ? or i will love to solve this. |
@Amanrk7 I think the goal here is to make them uniform in function calls and implementations (as opposed to originally make them shared). In this way, every file of code is self-contained and easier to follow. It would be helpful if you could figure out where those functions are, and how they are implemented - then make those functions 1.) use |
give me some sort of problems like this i will show you the output |
Please solve this problem
…On Sat, 11 Jun 2022, 18:32 Aman RK, ***@***.***> wrote:
Is this problem has been solved ? or i will love to solve this.
—
Reply to this email directly, view it on GitHub
<#5434 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATCOCCS3DUXUQW4EGPLFVXLVOS5SBANCNFSM5GIZBEHQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hi everyone! So I was searching for a good-first-issue to start contributing to the open source community, and since I have a PhD in Theoretical Computer Science, The Algorithms looks like the best place for me (python is also my favorite programming language 😉 ). So I was reading all these comments here and did some digging in the source code and I have the following.
I could do all these changes if no one else has done anything. Cheers to all of ya! 🍻 |
Hey @elpaxoudis! For 1 & 2, yes, and these can be done altogether in this issue. It would be of help if you could check also other algorithms and files in this repository which define a For 3, I agree that one of them is a duplicate. Let's handle it in a different issue (or without an issue because it's straightforward in terms of scale of change). We can merge all the test cases / comments, while preserving one clearer version. |
The next item would be to check against the project_euler files. Afterwards we can close this issue |
Great! Thank you for merging! So for the Euler files I was thinking of keeping one implementation which will be O(sqrt(n)) to be optimal and using that for all solutions that need primality checking. What do you think @poyea ? Additionally, I'd like to add doctests too. |
@elpaxoudis That sounds good to me 😃 - unless there's some weird specifications in the problem / custom implementation (say the author wrote a Sieve-like approach) which I'm sure it's rare. Doctests / test cases are always welcome! |
Please assign this to me. I would love to solve this problem. |
This is very similar problem which I am still facing here on the website you can see here and kindly help me about it I hope it will be a suitable choice. |
CAn i work on this issue please |
i nknow id problenn slot id ba top ell care full
…On Wed, Aug 10, 2022 at 3:06 PM Mahesh SV ***@***.***> wrote:
CAn i work on this issue please
—
Reply to this email directly, view it on GitHub
<#5434 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASOPK5AQKOK2ZQFCH3I2ULTVYNZZXANCNFSM5GIZBEHQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
if we are working on a list than we have sort it otherwise if we gave a limited amount of number than there is no need to do this we can just apply 2 nested loop it can easily give us the required output |
Hi I would like to work on this issue, Please assign this to me, if its still open. |
* fixes #5434 * fixes broken solution * removes assert * removes assert * Apply suggestions from code review Co-authored-by: John Law <[email protected]> * Update project_euler/problem_003/sol1.py Co-authored-by: John Law <[email protected]>
We have a lot of
is_prime
(or similar) functions: https://github.com/TheAlgorithms/Python/search?p=4&q=is_prime, https://github.com/TheAlgorithms/Python/search?q=isPrime, data_structures/hashing/number_theory/prime_numbers, etc. Shall we use one common function for that exactly identicalis_prime
calculation (which takesO(sqrt(n))
)?Candidates include:
The text was updated successfully, but these errors were encountered: