Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
ахахахах, так точно
Elegant, but not best practice because iterative solutions should be preferred over recursive ones.
Assumes all numbers are in range, returns error for if not.
No, 117 = 3313 and 117 ** 0.5 is about 10, so if you break the while loop, you won't find 13! But if you want to find out is a number prime, that will help.
Instead of saying
- 1 * (expression)
, you could say- (expression)
, as boolean values are interpreted as 1 or 0 in arithmetic, and you can subtract those as well like you can do with (almost) any value.can be fixed by replacing int(...) with ceil(...) - 1, see my solution
nice solution though
If you do p.append([m,1]) break the while loop when i ** 2 > m it will be faster.
Yeah that's enough.
https://www.geeksforgeeks.org/python-list-comprehensions-vs-generator-expressions/
Tried using this syntax for something else using elifs, didn't realise multiple elses could be chained like this until now.
This produces the character for every single element of inp. Kind of slow?
No.
Elegant solution but it looks like it obtains all the divisors to n, rather than just prime divisors.
Don't post solutions like this. Comments are visible by default to everyone so you must use a spoiler flag as soon as you post code somewhere.
Loading more items...