Anyone done problem set 1, problem 2, product of the primes? Write a program that computes the sum of the logarithms of all the primes from 2 to some number n, and print out the sum of the logs of the primes, the number n, and the ratio of these two quantities. Test this for different values of n. Basically all these. http://primes.utm.edu/lists/small/1000.txt
yes i have done it what part of it do you want help with
Okay so how do you add Logarithms if you just have the answer? Answer being 1000 primes. When it says compute the sum of Logarithms from 2 to some number n does it mean loop though all the primes and add it to some total variable? Then on the print statement how would you print the sum of the Logarithm? I know how a Logarithm works but the way this is explained it beyond me.
Is all this on base 10?
In part 1 you just needed to print the numbers. The addition of logarithms is part 2 of the question. In this part you need to go through all the primes between 2 and n, get the logarithm of each one and add it to a sum of all the logarithms. After you have done that, you need to print the sum you come up with (you should have a variable representing the sum, so you print that variable's value)
Join our real-time social learning platform and learn together with your friends!