Lord_David's blog

By Lord_David, history, 3 years ago, In English

So I've got a question about problems that need prime numbers. How are you meant to approach them? More specifically, how do you approach problems that require you to calculate prime numbers and do something with them? Do you implement/copy paste something like the sieve of Eratosthenes every time or is there a better method? Thanks in advance.

  • Vote: I like it
  • +7
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Your question sounds ambiguous to me so I cannot really fully answer it. The most important thing is, there is no rule to solve all problems. Prime numbers might occur in different ways and each problem will be different from other. That's why you should solve more problems to understand how primes might come in handy.

While solving problems, you will learn how to solve specific problems e.g. prime factorization in $$$O(logn)$$$ or check primality in more efficient way. If you want to learn more about primes (or number theory as a whole) then I suggest you to read this.