For a project i am asked to find primes from 1 to x and then use the number of primes to solve the Prime number theorem, which i did but prof doesn't want us to post code so idk if asking this way will be helpful with out the code. So i am suppose to use void test function which i never used and i am confused how it works. the only example he gave is:
I don't know if it's possible to explain it to me about how this works but if you can or give a example of something similar that will be very helpful.
What do you mean by "solve the Prime number theorem"? The theorem says that a number with 2n digits is half as likely to be prime as a number with n digits (for large enough n). You may be testing the theorem, but I doubt you'll be "solving" (proving?) it.
The "test" function is one that you need to write. You are given the prototype which shows it takes two integers: a and n. You must have been told what those parameters mean, so what are they?
Then you show some output whose meaning I can only guess at. You must have been told what it means, so what is it? What is pnt? What's up with the powers of 10? Why are they multiplied by 2? I could guess, but why should I? You must have been told this otherwise the assignment is senseless.
well not solving it just using the theorem like when number of prime from 1 to 20 is 8, so i did 8*1.0/(20/log(20)) which gave me 1.19829. The out line is:
1 2 3 4 5 6 7 8 9 10 11 12 13
typedefunsignedlonglong ull;
ull pi(ull x){
}
double pnt(ull x){
}
void test(int a, int n){
}
//...
int main(){
}
pnt(x) uses the Prime number theorem, pi(x) is for the number of primes. But i don't get what void test(int a, int n) i asked my professor over the email he gave this as example:
After going over the output few more time i think i was looking at it the wrong way since i never used void before, i am going to try it and see if i get the same output.