ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 17 Jan 2013 05:39:20 +0100sage samplehttps://ask.sagemath.org/question/9713/sage-sample/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
Wed, 16 Jan 2013 14:54:10 +0100https://ask.sagemath.org/question/9713/sage-sample/Comment by burcin for <p>hi i have a problem to solve, sorry if my english is bad :D:</p>
<p>I have to calculate function pi(x) that gives me a number of prime-numbers in range from zero to x.</p>
<p>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).</p>
<p>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%.</p>
<p>if you have any question just ask and I will try to answer them.</p>
<p>thank you soo much :D :D :D</p>
https://ask.sagemath.org/question/9713/sage-sample/?comment=18387#post-id-18387This sounds a lot like homework.Thu, 17 Jan 2013 05:39:20 +0100https://ask.sagemath.org/question/9713/sage-sample/?comment=18387#post-id-18387Answer by ppurka for <p>hi i have a problem to solve, sorry if my english is bad :D:</p>
<p>I have to calculate function pi(x) that gives me a number of prime-numbers in range from zero to x.</p>
<p>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).</p>
<p>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%.</p>
<p>if you have any question just ask and I will try to answer them.</p>
<p>thank you soo much :D :D :D</p>
https://ask.sagemath.org/question/9713/sage-sample/?answer=14466#post-id-14466There 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.Thu, 17 Jan 2013 01:07:59 +0100https://ask.sagemath.org/question/9713/sage-sample/?answer=14466#post-id-14466