Examples of Algorithms: Part 2

We'll look at different algorithms that help solve problems related to prime numbers.

Coding example: 72

In the following example, we will try to find the sum of prime divisors. Now, the question is what does this mean? What is the sum of prime divisors? Let’s find out!

To calculate the sum of the divisors of a number, we first do the prime factorization of that number. Then, we take each different prime factor and add together all its powers up to the one that appears in the above process of factorization. Then we multiply these sums together.

Admittedly, this type of problem is a bit tricky and seems weird. However, we try to push the barrier of learning and task you with something that you don’t understand at first. Only then can you learn something new! Everything takes time, this will too. If you want to rerun the code, write java main in the terminal:

Get hands-on with 1200+ tech skills courses.