Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.math > #325439 > unrolled thread

Fast computation of first Chebyshev function theta(x) in quad precision

Started byDavid Bernier <david250@videotron.ca>
First post2016-01-03 10:19 -0500
Last post2016-01-26 11:50 -0500
Articles 4 — 1 participant

Back to article view | Back to sci.math


Contents

  Fast computation of first Chebyshev function theta(x) in quad precision David Bernier <david250@videotron.ca> - 2016-01-03 10:19 -0500
    Re: Fast computation of first Chebyshev function theta(x) in quad precision David Bernier <david250@videotron.ca> - 2016-01-03 13:32 -0500
      Re: Fast computation of first Chebyshev function theta(x) in quad precision David Bernier <david250@videotron.ca> - 2016-01-05 12:16 -0500
        Re: Fast computation of first Chebyshev function theta(x) in quad precision David Bernier <david250@videotron.ca> - 2016-01-26 11:50 -0500

#325439 — Fast computation of first Chebyshev function theta(x) in quad precision

FromDavid Bernier <david250@videotron.ca>
Date2016-01-03 10:19 -0500
SubjectFast computation of first Chebyshev function theta(x) in quad precision
Message-ID<n6be0d$krd$1@dont-email.me>
I use Primesieve siever by Kim Walisch.

The argument 'x' is always such that pi(x) is a
multiple of 256, at the moment.

The Program finds in  2 minutes 11 seconds :

k = 32767996298 ...
vartheta(32767996298) = 32767816566.011100421399628405938

theta(32767996298) =    32767816566.011100421399628405895
// gp calculator

Chebyshev first function :

< https://en.wikipedia.org/wiki/Chebyshev_function > .


Right now, the C source code used is below:

---------- synthesis24.c ----------------------

#include <primesieve.h>
#include <stdio.h>
#include <stdlib.h>
#include <quadmath.h>

int main(void) {
  unsigned long long lastp;
  unsigned long long k;
  int dogo;
   __float128 f0;
   __float128 f1;
  int counter;
  primesieve_iterator pi;
  __float128 product_primes;
  __float128 sum_log_primes;

  primesieve_init(&pi);
  uint64_t prime = 0;
  f0 = (__float128) 0;
  f1 = (__float128) 1;

  dogo = 1;
  product_primes = f1;
  sum_log_primes  = f0;

  k = 32767996298ull;

  printf("k = %ld ...\n", k);
  fflush(stdout);

  while(dogo == 1)
  {
        for(counter = 0; counter < 256; counter++)
        {
           prime = primesieve_next_prime(&pi);
           lastp = prime;
           if(lastp <= k )
           {
              product_primes  = product_primes*((__float128)lastp) ;
           }
        }

        sum_log_primes = sum_log_primes + logq(product_primes);

        if(lastp > k)
        {
           dogo = 0;
        }

        product_primes = f1;
  }


  printf("vartheta(%ld) = %.32Qf\n", k, sum_log_primes);


  primesieve_free_iterator(&pi);
  return 0;
}

---------------------------------------------------------------


David Bernier



-- 
pub   4096R/41C769D6 2014-11-04
uid                  David Bernier (doubledeckerpot5)
<david250@videotron.ca>

[toc] | [next] | [standalone]


#325448

FromDavid Bernier <david250@videotron.ca>
Date2016-01-03 13:32 -0500
Message-ID<n6bpba$2l6$1@dont-email.me>
In reply to#325439
On 01/03/2016 10:19 AM, David Bernier wrote:
> I use Primesieve siever by Kim Walisch.
> 
> The argument 'x' is always such that pi(x) is a
> multiple of 256, at the moment.
> 
> The Program finds in  2 minutes 11 seconds :
> 
> k = 32767996298 ...
> vartheta(32767996298) = 32767816566.011100421399628405938
> 
> theta(32767996298) =    32767816566.011100421399628405895
> // gp calculator
> 
> Chebyshev first function :
> 
> < https://en.wikipedia.org/wiki/Chebyshev_function > .

There's a paper that was published in Math. Comp. in 2014,
by  Laura Faber and Habiba Kadiri :

"New bounds for psi(x) ",
Ref.:

<
http://www.ams.org/journals/mcom/2015-84-293/S0025-5718-2014-02886-X/home.html
> .


> 
> Right now, the C source code used is below:
> 
> ---------- synthesis24.c ----------------------


-- 
pub   4096R/41C769D6 2014-11-04
uid                  David Bernier (doubledeckerpot5)
<david250@videotron.ca>

[toc] | [prev] | [next] | [standalone]


#325554

FromDavid Bernier <david250@videotron.ca>
Date2016-01-05 12:16 -0500
Message-ID<n6gtkr$3b8$1@dont-email.me>
In reply to#325448
On 01/03/2016 01:32 PM, David Bernier wrote:
> On 01/03/2016 10:19 AM, David Bernier wrote:
>> I use Primesieve siever by Kim Walisch.
>>
>> The argument 'x' is always such that pi(x) is a
>> multiple of 256, at the moment.
>>
>> The Program finds in  2 minutes 11 seconds :
>>
>> k = 32767996298 ...
>> vartheta(32767996298) = 32767816566.011100421399628405938
>>
>> theta(32767996298) =    32767816566.011100421399628405895
>> // gp calculator
>>
>> Chebyshev first function :
>>
>> < https://en.wikipedia.org/wiki/Chebyshev_function > .
> 
> There's a paper that was published in Math. Comp. in 2014,
> by  Laura Faber and Habiba Kadiri :
> 
> "New bounds for psi(x) ",
> Ref.:
> 
> <
> http://www.ams.org/journals/mcom/2015-84-293/S0025-5718-2014-02886-X/home.html
>> .
> 

More test (non-production) output, for the first Chebyshev function,
sometimes denoted by \vartheta , other times by \theta ,
\vartheta (x) := sum_{ 1<= p <= x, and 'p' prime}  log(p)

Relative accuracy ~~= 1 part in 10^29 :


[david2@localhost primesieve-5.4.2]$ ./synthesis35a.out

k = 100 ...
vartheta(100) = 83.72839039906392294502692284987910

k = 1000 ...
vartheta(1000) = 956.24526512005886781240151676557267

k = 10000 ...
vartheta(10000) = 9895.99137915698731266894967030687742

k = 100000 ...
vartheta(100000) = 99685.38926861255083662385132292749065

k = 1000000 ...
vartheta(1000000) = 998484.17502563429213397303782969602030

k = 10000000 ...
vartheta(10000000) = 9995179.31785631189684434575699585163411

k = 100000000 ...
vartheta(100000000) = 99987730.01802200438321243426004884700613

k = 1000000000 ...
vartheta(1000000000) = 999968978.57756614479912623860232748422793

k = 10000000000 ...
vartheta(10000000000) = 9999939830.65775738415922199540309447387751

k = 100000000000 ...
vartheta(100000000000) = 99999737653.10744469485191257298387806052388

k = 1000000000000 ...
vartheta(1000000000000) = 999999030333.09622463699607903611815124244331

k = 10000000000000 ...
vartheta(10000000000000) = 9999996988293.03419965318214158068304013484567

k = 100000000000000 ...


David Bernier


-- 
pub   4096R/41C769D6 2014-11-04
uid                  David Bernier (doubledeckerpot5)
<david250@videotron.ca>

[toc] | [prev] | [next] | [standalone]


#326819

FromDavid Bernier <david250@videotron.ca>
Date2016-01-26 11:50 -0500
Message-ID<n887ve$ios$1@dont-email.me>
In reply to#325554
On 01/05/2016 12:16 PM, David Bernier wrote:
> On 01/03/2016 01:32 PM, David Bernier wrote:
>> On 01/03/2016 10:19 AM, David Bernier wrote:
>>> I use Primesieve siever by Kim Walisch.
>>>
>>> The argument 'x' is always such that pi(x) is a
>>> multiple of 256, at the moment.
>>>
>>> The Program finds in  2 minutes 11 seconds :
>>>
>>> k = 32767996298 ...
>>> vartheta(32767996298) = 32767816566.011100421399628405938
>>>
>>> theta(32767996298) =    32767816566.011100421399628405895
>>> // gp calculator
>>>
>>> Chebyshev first function :
>>>
>>> < https://en.wikipedia.org/wiki/Chebyshev_function > .
>>
>> There's a paper that was published in Math. Comp. in 2014,
>> by  Laura Faber and Habiba Kadiri :
>>
>> "New bounds for psi(x) ",
>> Ref.:
>>
>> <
>> http://www.ams.org/journals/mcom/2015-84-293/S0025-5718-2014-02886-X/home.html
>>> .
>>
> 
> More test (non-production) output, for the first Chebyshev function,
> sometimes denoted by \vartheta , other times by \theta ,
> \vartheta (x) := sum_{ 1<= p <= x, and 'p' prime}  log(p)
> 
> Relative accuracy ~~= 1 part in 10^29 :
> 
> 
> [david2@localhost primesieve-5.4.2]$ ./synthesis35a.out
> 
> k = 100 ...
> vartheta(100) = 83.72839039906392294502692284987910
> 
> k = 1000 ...
> vartheta(1000) = 956.24526512005886781240151676557267
> 
> k = 10000 ...
> vartheta(10000) = 9895.99137915698731266894967030687742
> 
> k = 100000 ...
> vartheta(100000) = 99685.38926861255083662385132292749065
> 
> k = 1000000 ...
> vartheta(1000000) = 998484.17502563429213397303782969602030
> 
> k = 10000000 ...
> vartheta(10000000) = 9995179.31785631189684434575699585163411
> 
> k = 100000000 ...
> vartheta(100000000) = 99987730.01802200438321243426004884700613
> 
> k = 1000000000 ...
> vartheta(1000000000) = 999968978.57756614479912623860232748422793
> 
> k = 10000000000 ...
> vartheta(10000000000) = 9999939830.65775738415922199540309447387751
> 
> k = 100000000000 ...
> vartheta(100000000000) = 99999737653.10744469485191257298387806052388
> 
> k = 1000000000000 ...
> vartheta(1000000000000) = 999999030333.09622463699607903611815124244331
> 
> k = 10000000000000 ...
> vartheta(10000000000000) = 9999996988293.03419965318214158068304013484567
> 
> k = 100000000000000 ...


$ ./synthesis37a.out > synthesis37a.txt
[started January 9 ]

To compile:
$ gcc -lprimesieve -lquadmath -O2 -o  synthesis37a.out   synthesis37a.c

echo $LD_LIBRARY_PATH
/usr/local/lib64::/home/david2/Downloads/primesieve-5.4.2/libs:/usr/local/lib64:/home/david2/Downloads/primesieve-5.4.2/include/primesieve

in directory:
/home/david2/Downloads/primesieve-5.4.2

$ tail synthesis37a.txt
[...]

k = 274664000000000 lastp = 274664000004937 sum_log_primes =
274663981498824.45945177688227742290633277832956

k = 274665000000000 lastp = 274665000004547 sum_log_primes =
274664981683361.08134544059337497028507393825869


274665000000000 ~= 274665 E+9 ~= 2.74665 E+14

in 17 days.


I used loops that multiplied 256 primes at a time. Thus, for
k = 274664000000000, the last product of 256 primes included
the prime 274664000004937 denoted 'lastp' and the computation
gives:
sum_{ p prime, p <= 274664000004937 }
~= 274663981498824.45945177688227742290633277832956 with
maybe 27 or 28 significant figures, judging by
a program that divides the product by integer powers of
2, synthesis41a.c .

With that, I'd like to continue the computations of
Keith Briggs and others on the size of
superabundant numbers, cf. for example:

"Fast prime-sieving programs and software", sci.math, June 2015,

< http://mathforum.org/kb/message.jspa?messageID=9807702 >

For the record, the source code synthesis37a.c is
reproduced below:


#include <primesieve.h>
#include <stdio.h>
#include <stdlib.h>
#include <quadmath.h>

int main(void) {
  unsigned long long lastp;
  unsigned long long k;
  int dogo;
   __float128 f0;
   __float128 f1;
  int counter;
  primesieve_iterator pi;
  __float128 product_primes;
  __float128 sum_log_primes;


  f0 = (__float128) 0;
  f1 = (__float128) 1;
  primesieve_init(&pi);
  uint64_t prime = 0;


  k = 1000000000ull;

  sum_log_primes  = f0;

while( 1 == 1)
{

  dogo = 1;
  product_primes = f1;



/***********************************************************


gcc -lprimesieve -lquadmath -O2 -o  synthesis27a.out   synthesis27a.c



[david2 at localhost primesieve-5.4.2]$ echo $LD_LIBRARY_PATH
/usr/local/lib64::/home/david2/Downloads/primesieve-5.4.2/libs:/usr/local/lib64:/home/david2/Downloads/primesieve-5.4.2/include/primesieve




*****************************************************/






  while(dogo == 1)
  {
        for(counter = 0; counter < 256; counter++)
        {
           prime = primesieve_next_prime(&pi);
           lastp = prime;
           product_primes  = product_primes*((__float128)lastp) ;
        }

        sum_log_primes = sum_log_primes + logq(product_primes);

        if(lastp > k)
        {
           dogo = 0;

           printf("k = %ld lastp = %ld sum_log_primes = %.32Qf\n", k,
lastp,  sum_log_primes);
           fflush(stdout);

        }

        product_primes = f1;


  }

  k = k + 1000000000ull;




}


primesieve_free_iterator(&pi);



  return 0;
}



David Bernier




-- 
pub   4096R/41C769D6 2014-11-04
uid                  David Bernier (doubledeckerpot5)
<david250@videotron.ca>

[toc] | [prev] | [standalone]


Back to top | Article view | sci.math


csiph-web