A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 4 years ago
I have been working through the ps1a and ps1b questions and am slowly getting there but i am not sure what is being asked in 1b i have the sum of the logs but i don't understand the ratio part.
Here is what i have so far
http://ideone.com/F8uXP
anonymous
 4 years ago
I have been working through the ps1a and ps1b questions and am slowly getting there but i am not sure what is being asked in 1b i have the sum of the logs but i don't understand the ratio part. Here is what i have so far http://ideone.com/F8uXP

This Question is Closed

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0Ratio is just the division of a quantity by another. If I recall correctly, you should divide the sum of log ( logprime1 + logprime2 ... ) by the log of the sum ( log ( prime1 + prime2 + prime 3 + ... + prime1000 ) ) But I don't remember exactly what are the order to divide. Check the pset pdf, should be clear there.

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0Let's take a simple case to understand the computation. Suppose we are trying to find the 10th prime number. The 10th prime number is: 29 The series is : [2,3,5,7,11,13,17,19,23,29] Logsum = log(2)+log(3)+...log(29) N=29 The ratio is: Logsum/N Your output should look like below. Notice as N increases the ratio converges to 1: @hich prime number do you want me to find: 10 The 10th prime is: 29 The ratio of LogSum/N is: 0.79659379841 >>> >>> Which prime number do you want me to find: 100 The 100th prime is: 541 The ratio of LogSum/N is: 0.935909535582 >>> >>> Which prime number do you want me to find: 1000 The 1000th prime is: 7919 The ratio of LogSum/N is: 0.986588504402

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0Thank you both here is my updated code any comments welcome but it works so i am happy http://ideone.com/Niwzs

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0Malpaso, For some reason, my ratios are somewhat different than yours. here's my code for the ratio: def sumlogprimeratio(x): z = 2 a = 0 b = 0 while z <= x: n = 2 while z%n != 0: n = n + 1 if n == z: a = z b = b + log(a) z +=1 print b/x Any thoughts on why that is?

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0My understanding of the assignment was that the ratio is between the sum of the logs of the primes smaller then or equal to the number 'n', and the number 'n'. If I'm not mistaken, the number 'n' is not necessarily prime. Am I right? For example: Say the number 'n' chosen is 15. The primes up to n would be: 2,3,5,7,11,13 So, it should do (log2 + log 3+ log 5 + log 7 + log 11 + log 13)/15 Right?

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0@Efarias. That's correct. n is the number that you are counting up to. But as the numbers get large the ratio will come out approximately the same whether you use, for example, 13 or 15.

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0@EFarias. Let me check.

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0@EFarias. Your code checks and the ratio is also correct. I will explain tomorrow why there is a discrepancy in our results. There isn't a real discrepancy. You did a good job and have gotten the correct result.

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0@malpaso. That´s good news! Looking forward to your explanation! Thanks!
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.