3
$\begingroup$

I studied hardy littlewood first conjecture, which predicts the density of primes of special form, so:

if I want to know the number of the primes of the form $2kp+1$, where $p$ is prime and $p \leq x$, then, according to hardy littlewood first conjecture, it is about $$2c_2\frac{x}{\ln^2 x}\prod^{}_{2<q|2k}\frac{q-1}{q-2}$$ where $c_2$ is hardy littlewood twin primes constant,

Now, if I want to know the number of the primes of the form $2kp+1$ where $1 \leq k \leq n$, $p$ is prime, and $p \leq x$, then it will be about

$$2c_2\frac{x}{\ln^2 x} \sum^{n}_{k=1} \prod^{}_{2<q|2k}\frac{q-1}{q-2}$$

Now my question is, is there any possibility to write and calculate this sum in pari gp calculator $$\sum^{n}_{k=1} \prod^{}_{2<q|2k}\frac{q-1}{q-2}$$

$\endgroup$
6
  • 1
    $\begingroup$ sum(k=1,n,prod(q=3,2*k,if((2*k)%q==0,(q-1)/(q-2),1))). n=7;sum(..)=547/40, n=17;sum(..)=18037309/480480, this true calculations? $\endgroup$ Commented May 16, 2020 at 6:07
  • $\begingroup$ thank you very much sir for this comment, it is a wonderful answer, but according to the fact that $q$ is prime, then the code must be sum(k=1,n,prod(q=2,2*k,if((2*k)%prime(q)==0,(prime(q)-1)/(prime(q)-2),1))), I tried the code, and it is correct, but could you please put your comment as an answer, so I can accept it, and of course upvote it, because it is actually a wonderful answer $\endgroup$
    – user788522
    Commented May 16, 2020 at 8:07
  • 1
    $\begingroup$ But prime(q) return q-th prime. Then is true n=7;sum(k=1,n,prod(q=3,2*k,if(isprime(q)&(2*k)%q==0,(q-1)/(q-2),1)))=143/15, n=17;sum(..)=11881/495? $\endgroup$ Commented May 16, 2020 at 8:31
  • $\begingroup$ yes, this code is correct, I suggest you to put it as an answer $\endgroup$
    – user788522
    Commented May 16, 2020 at 8:42
  • $\begingroup$ You are aware that the asymptotic is conjectured to hold only as $x\to \infty$, not as $k\to \infty$, which means that you need to hold $n$ fixed and let $x\to \infty$, you can't let $n\to \infty$ without a deeper discussion. $\endgroup$
    – reuns
    Commented May 16, 2020 at 15:27

1 Answer 1

1
$\begingroup$

sum(k=1,n,prod(q=3,2*k,if(isprime(q)&(2*k)%q==0,(q-1)/(q-2),1)))

Examples:

n=7;sum(..)=143/15

n=17;sum(..)=11881/495

$\endgroup$
5
  • $\begingroup$ hi sir, I have a question about the stored codes in pari, is it possible to delete or remove them, because I have thousands of them, and it takes me a few hours to search for a previous important code ? $\endgroup$
    – user788522
    Commented May 18, 2020 at 23:09
  • $\begingroup$ @hosamRamsey. Not understand your question. Edit and save your gp-code in any txt-editor (i use Far-editor), and run your code in pari/gp as \r file.gp. $\endgroup$ Commented May 19, 2020 at 3:12
  • $\begingroup$ I am very sorry, but I mean that is there any possibility to delete or remove all the stored codes in pari gp ?, in other words, I want to do a reset factor to pari gp $\endgroup$
    – user788522
    Commented May 19, 2020 at 7:56
  • $\begingroup$ @hosamRamsey. Sorry, me english from google translate, for me your question is not understand. $\endgroup$ Commented May 19, 2020 at 10:47
  • $\begingroup$ ok sir, thank you, and sorry for annoying $\endgroup$
    – user788522
    Commented May 19, 2020 at 15:57

You must log in to answer this question.