New answers tagged primes
1
vote
3
votes
Prime factorization for integers with up to 9-digit long prime factors
I would look up the pollard-rho algorithm. It doesn’t involve any higher mathematics, so you can implement it yourself. If a number n has a prime factor p, that prime factor can be found in about sqrt(...
7
votes
Find the smallest semiprime satisfying a bunch of conditions
To do this a lot faster:
You want to know whether say nine numbers are all primes. The obvious way of checking this is to test if the first number is prime, if it is prime then check the second number ...
5
votes
Find the smallest semiprime satisfying a bunch of conditions
repr
repr_a = str(a)
I found repr_a a confusing name for this,
given that we didn't call ...
7
votes
Find the smallest semiprime satisfying a bunch of conditions
As you only use isprime and factorint from sympy it would clean up your code to just import ...
7
votes
Find the smallest semiprime satisfying a bunch of conditions
any other feedback is welcome too
Here are some general coding style recommendations.
Documentation
The PEP 8 style guide recommends
adding a docstring at the top of the code to describe its purpose.
...
Top 50 recent answers are included
Related Tags
primes × 722performance × 221
python × 217
programming-challenge × 184
java × 119
c++ × 116
sieve-of-eratosthenes × 110
algorithm × 90
beginner × 88
python-3.x × 68
time-limit-exceeded × 66
factors × 61
c# × 56
c × 50
javascript × 29
haskell × 25
rust × 23
mathematics × 22
python-2.x × 14
c++11 × 13
multithreading × 13
ruby × 12
swift × 12
functional-programming × 11
recursion × 10