Problem set 1, problem 2. Can someone explain a bit more about what problem 2 wants.
They want you to write a program that computes the sum of logarithms of all primes from 2 to some number n. Then print out the sum the number and the ratio of these two quantities. The best place to start is to google both prime numbers and logarithm so you understand the question properly. Then once you understand what a prime and a log is do the problem by hand for a very small number carefully noting how you solve it. Write this out as an algorithm and then translate that algorithm to code.
hint you will have to solve what a prime is from problem 1 to do this
I completed the code for problem 1. Is problem 2 wanting me to add the logs of the primes together, eg: n = 3 sum = log(2) + log(3) + log(5) and then get the ratio by sum / n ? thanks for previously responding.
yep you will have to use a loop to iterate up to n. When you run it you should see that the ratio gets closer to 1 as it goes.
Join our real-time social learning platform and learn together with your friends!