answersLogoWhite

0


Best Answer

from math import *

def testPrime(x):

factor = 2

while factor**2 <= x:

if x % factor == 0:

return False

else:

factor = factor + 1

return True

candidate = 3

primeLogSum = log(2)

n = int(raw_input("What is n? "))

while candidate < n:

if testPrime(candidate):

primeLogSum = primeLogSum + log(candidate)

candidate = candidate + 2

print primeLogSum, n, primeLogSum/n

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Using python how to print the sum of logs of primes?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Where can I print some food logs?

Health food stores such as GNC can provide you with food logs. you can also go to amazon.com in order to find the most appropriate food logs for you and your family


Using logs what is 632x85.3?

632x85.3 = 53909.6


How do you control heat in woodstove?

Damper , and using fewer logs


How do you check booting error logs in AIX?

using the command # errpt


How did the arawaks move from one island to the other?

They did by using dug-out tree logs.


How many willow logs does it take from lvl 70-99 fletching?

I would strongly recommend using diffrent logs if you can but otherwise it probably would take at least maby 2m 1m logs which i have no clue i just like to help people with runescape


What is the number of wall logs for a rectangular log crib using the post offset design?

10


What are the steps involved in multiplication using logarithms?

Given X and Y, you wish to find X*Y using logarithms.Find a = log(X) and b = log(Y) to any base zCalculate c = a + bFind z^c: this is the required answer.You can take logs to any base, z. For common logs, the base is 10; for natural logs it is e (Euler's number).


How are rotting logs similar to burning logs?

They both r logs


How long should you let pine logs dry before using to make furniture?

You have to wait about a week.


How many willow logs starting from lvl 30 FM does it take to get 99 firemaking in runescape?

You will need 150k willow logs to get 99 firemaking. I suggest using maples and yews after because it is faster.


How do you view encrypted Trillian chat logs?

Find your logs at C:\Program Files\Trillian\users\default\logs... (\AIM\Query, if you're using AIM). Logs are labeled by screenname (of the other person, in the format of "[screenname].log". Find the one that you want to view. Right click it and choose "Open With...", and then open the file with "Notepad." Within Trillian, you can view the logs by right-clicking the screenname and choose "View Contact History."