Ask Your Question

sage sample

asked 2013-01-16 14:54:10 +0200

anonymous user


updated 2013-01-16 14:55:34 +0200

hi i have a problem to solve, sorry if my english is bad :D:

I have to calculate function pi(x) that gives me a number of prime-numbers in range from zero to x.

x=10^10 and i have to take a sample of n random numbers from 1 to x and test how much of them are primes. then from that part(proportion) i have to calculate pi(x).

another question is : what amount of sample i have to take so that relative error, when i calculate number od prime number by prime_pi(10^10), falls below 1%.

if you have any question just ask and I will try to answer them.

thank you soo much :D :D :D

edit retag flag offensive close merge delete


This sounds a lot like homework.

burcin gravatar imageburcin ( 2013-01-17 05:39:20 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-01-17 01:07:59 +0200

ppurka gravatar image

There are already several functions which give the primes or number of primes in a particular range, in Sage - prime_pi, prime_range, primes, primes_first_n, etc.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-01-16 14:54:10 +0200

Seen: 339 times

Last updated: Jan 17 '13