meditationatae

Just another WordPress.com site

Source code for $HOME//eratosthenes6/superabun3842a.c

#include <stdio.h>
#include <quadmath.h>
#include <stdlib.h>
__float128 splogs[250000];
__float128 theta[250000];
__float128 prod100k[250000];
long ptr_exponents[250000];
long ptr_current_powers[250000];
long ptr_current_sigmas[250000];
long pts_primes[250000];
long ptr_isstep[250000];
long sivsmall_primes[150000];

unsigned char sivptr_remains[10000000];

int main(void)
{
long theIndex;
__float128 euler = 0.5772156649015328606065120900824024Q;
long j;
long numprimes;
long num_new_primes;
long file_offset;
long jj;
long kij;
long kijj;
long numBigPrimesUsed;
__float128 sum_log_cofactor;
__float128 sum_theta_Cheb;
long numsteps;
long expon;
long sigma;
long * ptr_primes;
long list_steps[1000];
long power;
long old_prime;
long powerb;
int nownow;
int go_skip;
int answer;
long k;
long l;
long numloops;
long vintageloops;
long tmp_exponent;
long m;
long p;
long sum;
int not_done;
int junk;
int leave_loop;
long ljunk;
int skip_base_case;
long current_step;
long now_step;
__float128 RecordRobinQuotient;
__float128 RecordQuotient;
__float128 tmp_now_n;
__float128 log2nprime;
__float128 robin_bound;
__float128 base_tmp_now_n;
long RecordStep;
__float128 tmp_now_robin;
__float128 constant;
__float128 prod_sigma_r;
__float128 prod_sigma_rone;
__float128 base_tmp_now_sigma_r;
__float128 prod_sigma_r_cofactor;
__float128 tmp_now_sigma_r;
__float128 tmp_now_quotient;
__float128 delta;
__float128 delta_log;
__float128 delta_estimate;
__float128 variation_delta;
__float128 record_low_variation_delta;
__float128 record_low_log2n;
__float128 tmp_el_now_robin;
__float128 now_n;
long current_step_number;
__float128 sum_logs_primes;
__float128 sum_logs_all;
__float128 ratio;
__float128 now_robin;
__float128 val128a;
FILE *in;
long sivoffset;
long sivj;
long sivp;
long sivblock_size;
unsigned char sivuc1;
unsigned char sivuc0;
long sivindex;
long sivblockprimecount;
long sivrem;
long sivcount;
long sivcount_new_primes;
long sivbarred;
long siv_left_overs;
long siv_keeps;
long sivp_num;
long siv_last_sivj;
long sivoffset_next;
int sivbatchdone;
FILE *out;
ptr_primes = (long *) calloc(80000000, sizeof(long));

sivblock_size = (long) 10000000;
sivuc1 = (unsigned char) 1;
sivuc0 = (unsigned char) 0;

sivcount = 8000000000 ;
sivoffset = 199815106450;

record_low_variation_delta = (__float128) 100;
record_low_log2n = (__float128) 0;
in = fopen(“/home/david2/eratosthenes/primes100meg01a_tmp.txt”, “r”);
for(j=0; j< 250000 ; j++)
{
fscanf(in, “%ld”, &theIndex);
fscanf(in, “%ld”, &pts_primes[j]);
}
fclose(in);

for(sivj=0; sivj< 150000; sivj++)
{
sivsmall_primes[sivj] = pts_primes[sivj] ;
}
constant = ((__float128) 323336)/((__float128) 1000000);

val128a = 1.0Q;
for(j=0; j<250000; j++)
{
val128a = val128a*(1.0Q + 1.0Q/((__float128)pts_primes[j]));
prod100k[j] = val128a;
}
in = fopen(“/home/david2/eratosthenes/LargePrimes_to_1e10a.txt”, “r”);
for(j=0; j<79920000 ; j++)
{
fscanf(in, “%ld”, &ljunk);
}
for(j=0; j< 80000000 ; j++)
{
fscanf(in, “%ld”, &ptr_primes[j]);
}

fclose(in);

for(j=0; j< 250000 ; j++)
{
ptr_exponents[j] = (long) 0;
}
prod_sigma_r = (__float128) 1;

prod_sigma_rone = (__float128) 1;

for(j=0; j< 250000 ; j++)
{
ptr_isstep[j] = (long) 0;
}
in = fopen(“/home/david2/eratosthenes/exponents_out802a.txt”, “r”);
for(j=0; j< 250000 ; j++)
{
fscanf(in, “%ld”, &theIndex);
fscanf(in, “%ld”, &ptr_exponents[j]);
}
fclose(in);

for(j=0; j< 250000 ; j++)
{
p = pts_primes[j];
power = (long) 1;

for(l=0; l<ptr_exponents[j]; l++)
{
power = power*p;
}

ptr_current_powers[j] = power;
}
for(j=0; j< 250000 ; j++)
{
p = pts_primes[j];
power = (long) 1;

for(l=0; l<ptr_exponents[j]; l++)
{
power = power*p + ((long) 1);
}

ptr_current_sigmas[j] = power;
}
numprimes = (long) 80000000;

numBigPrimesUsed = (long) 79000000;

leave_loop = 0;
in = fopen(“/home/david2/eratosthenes/primes_out802a.txt”, “r”);

sum_logs_primes = (__float128) 0;
sum_logs_all = (__float128) 0;
for(j=0; j<80000000; j++)
{
fscanf(in, “%ld”, &ljunk);
fscanf(in, “%ld”, &old_prime);
sum_logs_primes = sum_logs_primes + logq((__float128)old_prime);

if(j < 250000)
{
sum_logs_all = sum_logs_all + ((__float128)ptr_exponents[j])*logq((__float128)old_prime);
}
else
{
sum_logs_all = sum_logs_all + logq((__float128)old_prime);
}
}

fclose(in);

for(j=0; j<250000; j++)
{
splogs[j] = logq((__float128) pts_primes[j]);
}

sum_theta_Cheb = (__float128) 0;
for(j=0; j<250000; j++)
{
sum_theta_Cheb = sum_theta_Cheb + logq((__float128) pts_primes[j]) ;
theta[j] = sum_theta_Cheb;
}
skip_base_case = (int) 0;
for(j=0; j< 250000 ; j++)
{

p = pts_primes[j];

expon = ptr_exponents[j];

ratio = (__float128) 1;

for(jj = 0; jj < 1; jj++)
{
ratio = ((__float128)1) + (ratio/((__float128) p) );
}

if(expon == 1)
{
prod_sigma_rone = prod_sigma_rone*ratio;
}
prod_sigma_r = prod_sigma_r*ratio;
}

in = fopen(“/home/david2/eratosthenes/primes_out802a.txt”, “r”);

for(j=0 ; j<numprimes; j++)
{
fscanf(in, “%ld”, &ljunk);
fscanf(in, “%ld”, &old_prime);

if( j > 249999 )
{
prod_sigma_r = prod_sigma_r + (prod_sigma_r/((__float128)old_prime)) ;
prod_sigma_rone = prod_sigma_rone + (prod_sigma_rone/((__float128)old_prime)) ;
}
}

fclose(in);
for(numloops = 0; numloops < 80002284 ; numloops++)
{

ptr_isstep[0] = (long) 1;
list_steps[0] = (long) 0;
numsteps = (long) 1;
not_done = (int) 1;
j = (long) 0;

while(not_done == 1)
{
j++;

if(ptr_exponents[j]< ptr_exponents[j-1])
{
ptr_isstep[j] = (long) 1;
list_steps[numsteps] = j;
numsteps++;
}
else
{
ptr_isstep[j] = (long) 0;
}

if(ptr_exponents[j] == ((long) 1))
{
not_done = (int) 0;
}

}

list_steps[numsteps] = numprimes;
numsteps++;
if( (2283 ==(numloops%64000)) || (((numloops – 80002283) < 6)&&((80002283-numloops) < 6)) )
{
for(j=0; j< numsteps; j++)
{
printf(“step at %ld\n”, list_steps[j]);
}
printf(“\nNumber of big primes used in making current n is: %ld\n”, numBigPrimesUsed);
printf(“numloops = %ld\n”, numloops);
printf(“\n”);

if(numloops == 80002283)
{
printf(“numloops = %ld\n”, numloops);
printf(“break from current loop, ok?\n”);
printf(“enter 1 for yes, 0 for no:\n”);

if(1 == 1)
{
leave_loop = 1;
}
else
{
leave_loop = 1;
}
}
}

if(leave_loop == 0)
{
if((2283 ==(numloops%64000)) || (((numloops – 80002283) < 6)&&((80002283-numloops) < 6)) )
{
printf(“number of steps: %ld\n”, numsteps);
}
RecordRobinQuotient = (__float128) 0;
if(skip_base_case == 0)
{

base_tmp_now_n = (__float128) 0;

base_tmp_now_sigma_r = (__float128) 1;

now_step = (long) 0;

for(j=0; j<= list_steps[numsteps-2]; j++)
{
if(j == list_steps[now_step] )
{
now_step++;
}
else
{
base_tmp_now_n = base_tmp_now_n + ((__float128)ptr_exponents[j])*splogs[j];
// p = pts_primes[j];
// power = (long) 1;
// for(l=0; l<ptr_exponents[j]+((long)1); l++)
// {
// power = power*p;
// }

// powerb = power/p;

powerb = ptr_current_powers[j];

// sigma = (power – ((long)1) )/(p – ((long)1));

sigma = ptr_current_sigmas[j];

ratio = ((__float128)sigma)/((__float128)powerb);
base_tmp_now_sigma_r = base_tmp_now_sigma_r*ratio;
}
}
}

sum_log_cofactor = sum_logs_primes;

prod_sigma_r_cofactor = prod_sigma_r;
sum_log_cofactor = sum_log_cofactor – theta[list_steps[numsteps-2]];

prod_sigma_r_cofactor = prod_sigma_r_cofactor/prod100k[list_steps[numsteps-2]];
for(m=0; m< numsteps ; m++)
{
current_step_number = m;

current_step = list_steps[m];

tmp_now_n = sum_log_cofactor + base_tmp_now_n;
tmp_now_sigma_r = base_tmp_now_sigma_r*prod_sigma_r_cofactor;
if(m < numsteps-((long)1) )
{
for(j=0; j<= numsteps- ((long)2) ; j++)
{
p = pts_primes[list_steps[j]];

if(j == m)
{
tmp_exponent = ptr_exponents[list_steps[j]] + ((long)1);
powerb = ptr_current_powers[list_steps[j]]*p;
sigma = ptr_current_sigmas[list_steps[j]]*p + ((long)1);
}
else
{
tmp_exponent = ptr_exponents[list_steps[j]];
powerb = ptr_current_powers[list_steps[j]];
sigma = ptr_current_sigmas[list_steps[j]];
}

tmp_now_n = tmp_now_n + ((__float128)tmp_exponent)*splogs[list_steps[j]];

ratio = ((__float128)sigma)/((__float128)powerb);
tmp_now_sigma_r = tmp_now_sigma_r*ratio;
}
tmp_now_quotient = tmp_now_sigma_r;

tmp_now_robin = tmp_now_quotient/expq(euler);

tmp_el_now_robin = tmp_now_robin/logq(tmp_now_n);

tmp_now_robin = tmp_el_now_robin;

if(tmp_now_robin > RecordRobinQuotient)
{
RecordRobinQuotient = tmp_now_robin;
RecordStep = current_step;
}
if((2283 ==(numloops%64000)) || (((numloops – 80002283) < 6)&&((80002283-numloops) < 6)) )
{

printf(“current step number = %ld “, current_step_number);

printf(“quotient de Robin: %.30Qf “, tmp_now_robin);

printf(“\nloglog n = %.30Qf\n”, logq(tmp_now_n));

printf(“\nsigma(n’)/n’ = %.30Qf\n”, tmp_now_sigma_r);
printf(“record step is at: %ld\n”, RecordStep);

}
}
else
{
for(j=0; j<= numsteps- ((long)2) ; j++)
{
tmp_exponent = ptr_exponents[list_steps[j]];

p = pts_primes[list_steps[j]];

tmp_now_n = tmp_now_n + ((__float128)tmp_exponent)*splogs[list_steps[j]];

powerb = ptr_current_powers[list_steps[j]];

sigma = ptr_current_sigmas[list_steps[j]];

ratio = ((__float128)sigma)/((__float128)powerb);

tmp_now_sigma_r = tmp_now_sigma_r*ratio;

}

tmp_now_n = tmp_now_n + logq((__float128) ptr_primes[current_step-80000000]);
ratio = ((__float128)1)/( (__float128)ptr_primes[current_step-80000000] );

tmp_now_sigma_r = tmp_now_sigma_r + (ratio*tmp_now_sigma_r) ;

tmp_now_quotient = tmp_now_sigma_r;
tmp_now_robin = tmp_now_quotient/expq(euler);

tmp_el_now_robin = tmp_now_robin/logq(tmp_now_n);

tmp_now_robin = tmp_el_now_robin;
if(tmp_now_robin > RecordRobinQuotient)
{
RecordRobinQuotient = tmp_now_robin;
RecordStep = current_step;
}

if((2283 ==(numloops%64000)) || (((numloops – 80002283) < 6)&&((80002283-numloops) < 6)) )
{
printf(“current step number = %ld “, current_step_number);

printf(“quotient de Robin: %.30Qf “, tmp_now_robin);

printf(“\nloglog n = %.30Qf\n”, logq(tmp_now_n));

printf(“\nsigma(n’)/n’ = %.30Qf\n”, tmp_now_sigma_r);
printf(“record step is at: %ld\n”, RecordStep);
}
}

}

if(RecordStep < numprimes)
{
ptr_exponents[RecordStep]++;
p = pts_primes[RecordStep];

ptr_current_powers[RecordStep] = ptr_current_powers[RecordStep]*p;
ptr_current_sigmas[RecordStep] = ptr_current_sigmas[RecordStep]*p + ((long) 1);

}
if(RecordStep == numprimes)
{
sum_logs_primes = sum_logs_primes + logq( (__float128) ptr_primes[numprimes-80000000]);

ratio = ((__float128)1)/((__float128)ptr_primes[numprimes-80000000]);

if( RecordStep > 999999 )
{
numBigPrimesUsed++;
}

prod_sigma_r = prod_sigma_r + (prod_sigma_r*ratio) ;

numprimes++;
skip_base_case = (int) 1;
}
else
{
skip_base_case = (int) 0;
}

if( 2283 ==(numloops%64000) )
{
for(j=0; j< 200 ; j++)
{
printf(“%ld “, ptr_exponents[j]);
}

printf(“\n\n”);
}
}
/*** if leave loop == 0 ****/
if( leave_loop == 1 )
{
break;
}
}

/**************** next 80 million batch … *****************/
/*************************************************************
prime 160,000,000 is:

3340200037

or

3,340,200,037 .

:159920000p
3340200037
3340200037
************************************************************/

in = fopen(“/home/david2/eratosthenes/LargePrimes_to_1e11ofNov22a.txt”, “r”);
for(j=0; j< 159920000 ; j++)
{
fscanf(in, “%ld”, &old_prime);
}
for(j=0; j< 80000000 ; j++)
{
fscanf(in, “%ld”, &ptr_primes[j]);
}
/**************************************

==============================================
next: loops ….

******************************************************/
file_offset = (long) 160000000;
num_new_primes = (long) 0;

numloops = (long) 0;
while( num_new_primes < ((long)80000000) )
{
numloops++;

ptr_isstep[0] = (long) 1;
list_steps[0] = (long) 0;
numsteps = (long) 1;
not_done = (int) 1;
j = (long) 0;

while(not_done == 1)
{
j++;

if(ptr_exponents[j]< ptr_exponents[j-1])
{
ptr_isstep[j] = (long) 1;
list_steps[numsteps] = j;
numsteps++;
}
else
{
ptr_isstep[j] = (long) 0;
}

if(ptr_exponents[j] == ((long) 1))
{
not_done = (int) 0;
}

}

list_steps[numsteps] = numprimes;
numsteps++;

if( 9999 == (num_new_primes%10000) )
{
for(j=0; j< numsteps; j++)
{
printf(“step at %ld\n”, list_steps[j]);
}
printf(“\nNumber of big primes used in making current n is: %ld\n”, numBigPrimesUsed);
printf(“numloops = %ld\n”, numloops);
printf(“\n”);
}
if( 9999 == (num_new_primes%10000) )
{
printf(“number of steps: %ld\n”, numsteps);
}
RecordRobinQuotient = (__float128) 0;
if(skip_base_case == 0)
{

base_tmp_now_n = (__float128) 0;

base_tmp_now_sigma_r = (__float128) 1;

now_step = (long) 0;

for(j=0; j<= list_steps[numsteps-2]; j++)
{
if(j == list_steps[now_step] )
{
now_step++;
}
else
{
base_tmp_now_n = base_tmp_now_n + ((__float128)ptr_exponents[j])*splogs[j];

powerb = ptr_current_powers[j];

sigma = ptr_current_sigmas[j];

ratio = ((__float128)sigma)/((__float128)powerb);
base_tmp_now_sigma_r = base_tmp_now_sigma_r*ratio;
}
}
}

sum_log_cofactor = sum_logs_primes;

prod_sigma_r_cofactor = prod_sigma_r;
sum_log_cofactor = sum_log_cofactor – theta[list_steps[numsteps-2]];

prod_sigma_r_cofactor = prod_sigma_r_cofactor/prod100k[list_steps[numsteps-2]];

for(m=0; m< numsteps ; m++)
{
current_step_number = m;

current_step = list_steps[m];

tmp_now_n = sum_log_cofactor + base_tmp_now_n;
tmp_now_sigma_r = base_tmp_now_sigma_r*prod_sigma_r_cofactor;
if(m < numsteps-((long)1) )
{
for(j=0; j<= numsteps- ((long)2) ; j++)
{
if(j == m)
{
tmp_exponent = ptr_exponents[list_steps[j]] + ((long)1);
powerb = ptr_current_powers[list_steps[j]]*p;
sigma = ptr_current_sigmas[list_steps[j]]*p + ((long)1);
}
else
{
tmp_exponent = ptr_exponents[list_steps[j]];
powerb = ptr_current_powers[list_steps[j]];
sigma = ptr_current_sigmas[list_steps[j]];
}
tmp_now_n = tmp_now_n + ((__float128)tmp_exponent)*splogs[list_steps[j]];
ratio = ((__float128)sigma)/((__float128)powerb);
tmp_now_sigma_r = tmp_now_sigma_r*ratio;
}

tmp_now_quotient = tmp_now_sigma_r;

tmp_now_robin = tmp_now_quotient/expq(euler);

tmp_el_now_robin = tmp_now_robin/logq(tmp_now_n);

tmp_now_robin = tmp_el_now_robin;

if(tmp_now_robin > RecordRobinQuotient)
{
RecordRobinQuotient = tmp_now_robin;
RecordStep = current_step;
}
if( 9999 == (num_new_primes%10000) )
{

printf(“current step number = %ld “, current_step_number);

printf(“quotient de Robin: %.30Qf “, tmp_now_robin);

printf(“\nloglog n = %.30Qf\n”, logq(tmp_now_n));

printf(“\nsigma(n’)/n’ = %.30Qf\n”, tmp_now_sigma_r);
printf(“record step is at: %ld\n”, RecordStep);

}
}
else
{
for(j=0; j<= numsteps- ((long)2) ; j++)
{

tmp_exponent = ptr_exponents[list_steps[j]];

p = pts_primes[list_steps[j]];

tmp_now_n = tmp_now_n + ((__float128)tmp_exponent)*splogs[list_steps[j]];

powerb = ptr_current_powers[list_steps[j]];

sigma = ptr_current_sigmas[list_steps[j]];

ratio = ((__float128)sigma)/((__float128)powerb);

tmp_now_sigma_r = tmp_now_sigma_r*ratio;

}

tmp_now_n = tmp_now_n + logq((__float128) ptr_primes[current_step- file_offset]);
ratio = ((__float128)1)/( (__float128)ptr_primes[current_step- file_offset] );

tmp_now_sigma_r = tmp_now_sigma_r + (ratio*tmp_now_sigma_r) ;

tmp_now_quotient = tmp_now_sigma_r;
tmp_now_robin = tmp_now_quotient/expq(euler);

tmp_el_now_robin = tmp_now_robin/logq(tmp_now_n);

tmp_now_robin = tmp_el_now_robin;
if(tmp_now_robin > RecordRobinQuotient)
{
RecordRobinQuotient = tmp_now_robin;
RecordStep = current_step;
}

if( 9999 == (num_new_primes%10000) )
{
printf(“current step number = %ld “, current_step_number);

printf(“quotient de Robin: %.30Qf “, tmp_now_robin);

printf(“\nloglog n = %.30Qf\n”, logq(tmp_now_n));

printf(“\nsigma(n’)/n’ = %.30Qf\n”, tmp_now_sigma_r);

printf(“record step is at: %ld\n”, RecordStep);
}
}

}

if(RecordStep < numprimes)
{
ptr_exponents[RecordStep]++;

p = pts_primes[RecordStep];

ptr_current_powers[RecordStep] = ptr_current_powers[RecordStep]*p;

ptr_current_sigmas[RecordStep] = ptr_current_sigmas[RecordStep]*p + ((long) 1);

}
if(RecordStep == numprimes)
{
sum_logs_primes = sum_logs_primes + logq( (__float128) ptr_primes[numprimes- file_offset]);

ratio = ((__float128)1)/((__float128)ptr_primes[numprimes-file_offset]);

if( RecordStep > 999999 )
{
numBigPrimesUsed++;
}

num_new_primes++;

prod_sigma_r = prod_sigma_r + (prod_sigma_r*ratio) ;

numprimes++;
skip_base_case = (int) 1;
}
else
{
skip_base_case = (int) 0;
}

if( 99999 == (num_new_primes%100000) )
{
for(j=0; j< 200 ; j++)
{
printf(“%ld “, ptr_exponents[j]);
}

printf(“\n\n”);
}
}
/********************** Next batch 80 M and loop *******************/

for(kij = 1; kij < 49; kij++)
{

for(j=0; j< 80000000 ; j++)
{
fscanf(in, “%ld”, &ptr_primes[j]);
}

file_offset = file_offset + ((long)80000000) ;

/*** 240 000 000 for kij=1 ***/
num_new_primes = (long) 0;

numloops = (long) 0;

while( num_new_primes < ((long)80000000) )
{
numloops++;

ptr_isstep[0] = (long) 1;
list_steps[0] = (long) 0;
numsteps = (long) 1;
not_done = (int) 1;
j = (long) 0;

while(not_done == 1)
{
j++;

if(ptr_exponents[j]< ptr_exponents[j-1])
{
ptr_isstep[j] = (long) 1;
list_steps[numsteps] = j;
numsteps++;
}
else
{
ptr_isstep[j] = (long) 0;
}

if(ptr_exponents[j] == ((long) 1))
{
not_done = (int) 0;
}

}

list_steps[numsteps] = numprimes;
numsteps++;

if( 99999 == (numloops%100000) )
{
for(j=0; j< numsteps; j++)
{
printf(“step at %ld\n”, list_steps[j]);
}
printf(“\nNumber of big primes used in making current n is: %ld\n”, numBigPrimesUsed);
printf(“numloops = %ld\n”, numloops);
printf(“\n”);
}
if( 99999 == (numloops%100000) )
{
printf(“number of steps: %ld\n”, numsteps);
}
if( 99999 == (numloops%100000) )
{
for(j=0; j< 200 ; j++)
{
printf(“%ld “, ptr_exponents[j]);
}

printf(“\n”);
}

RecordRobinQuotient = (__float128) 0;
if(skip_base_case == 0)
{

base_tmp_now_n = (__float128) 0;

base_tmp_now_sigma_r = (__float128) 1;

now_step = (long) 0;

for(j=0; j<= list_steps[numsteps-2]; j++)
{
if(j == list_steps[now_step] )
{
now_step++;
}
else
{
base_tmp_now_n = base_tmp_now_n + ((__float128)ptr_exponents[j])*splogs[j];

powerb = ptr_current_powers[j];

sigma = ptr_current_sigmas[j];

ratio = ((__float128)sigma)/((__float128)powerb);
base_tmp_now_sigma_r = base_tmp_now_sigma_r*ratio;
}
}
}

sum_log_cofactor = sum_logs_primes;

prod_sigma_r_cofactor = prod_sigma_r;
sum_log_cofactor = sum_log_cofactor – theta[list_steps[numsteps-2]];

prod_sigma_r_cofactor = prod_sigma_r_cofactor/prod100k[list_steps[numsteps-2]];

for(m=0; m< numsteps ; m++)
{
current_step_number = m;

current_step = list_steps[m];

tmp_now_n = sum_log_cofactor + base_tmp_now_n;
tmp_now_sigma_r = base_tmp_now_sigma_r*prod_sigma_r_cofactor;
if(m < numsteps-((long)1) )
{

for(j=0; j<= numsteps- ((long)2) ; j++)
{
p = pts_primes[list_steps[j]];

if(j == m)
{
tmp_exponent = ptr_exponents[list_steps[j]] + ((long)1);
powerb = ptr_current_powers[list_steps[j]]*p;
sigma = ptr_current_sigmas[list_steps[j]]*p + ((long)1);
}
else
{
tmp_exponent = ptr_exponents[list_steps[j]];
powerb = ptr_current_powers[list_steps[j]];
sigma = ptr_current_sigmas[list_steps[j]];
}

tmp_now_n = tmp_now_n + ((__float128)tmp_exponent)*splogs[list_steps[j]];

ratio = ((__float128)sigma)/((__float128)powerb);
tmp_now_sigma_r = tmp_now_sigma_r*ratio;
}

tmp_now_quotient = tmp_now_sigma_r;

tmp_now_robin = tmp_now_quotient/expq(euler);

log2nprime = logq(tmp_now_n);

robin_bound = expq(euler)*log2nprime;

tmp_el_now_robin = tmp_now_robin/logq(tmp_now_n);

tmp_now_robin = tmp_el_now_robin;

if(tmp_now_robin > RecordRobinQuotient)
{
RecordRobinQuotient = tmp_now_robin;
RecordStep = current_step;
}
if( 99999 == (numloops%100000) )
{

printf(“current step number = %ld “, current_step_number);

printf(“quotient de Robin: %.30Qf “, tmp_now_robin);

printf(“\nloglog n = %.30Qf\n”, logq(tmp_now_n));

printf(“\nsigma(n’)/n’ = %.30Qf\n”, tmp_now_sigma_r);

printf(“record step is at: %ld\n”, RecordStep);

printf(“log(log(n’)) = %.30Qf “, log2nprime);

printf(“Robin upper bound = %.30Qf “, robin_bound);

printf(“sigma(n’)/n’ = %.30Qf \n”, tmp_now_quotient);
}
}
else
{

for(j=0; j<= numsteps- ((long)2) ; j++)
{

tmp_exponent = ptr_exponents[list_steps[j]];

p = pts_primes[list_steps[j]];

tmp_now_n = tmp_now_n + ((__float128)tmp_exponent)*splogs[list_steps[j]];

powerb = ptr_current_powers[list_steps[j]];

sigma = ptr_current_sigmas[list_steps[j]];

ratio = ((__float128)sigma)/((__float128)powerb);

tmp_now_sigma_r = tmp_now_sigma_r*ratio;

}

tmp_now_n = tmp_now_n + logq((__float128) ptr_primes[current_step- file_offset]);
ratio = ((__float128)1)/( (__float128)ptr_primes[current_step- file_offset] );

tmp_now_sigma_r = tmp_now_sigma_r + (ratio*tmp_now_sigma_r) ;

tmp_now_quotient = tmp_now_sigma_r;
tmp_now_robin = tmp_now_quotient/expq(euler);
log2nprime = logq(tmp_now_n);
robin_bound = expq(euler)*log2nprime;
tmp_el_now_robin = tmp_now_robin/logq(tmp_now_n);

tmp_now_robin = tmp_el_now_robin;
if(tmp_now_robin > RecordRobinQuotient)
{
RecordRobinQuotient = tmp_now_robin;
RecordStep = current_step;
}

if( 99999 == (numloops%100000) )
{
printf(“current step number = %ld “, current_step_number);

printf(“quotient de Robin: %.30Qf “, tmp_now_robin);

printf(“\nloglog n = %.30Qf\n”, logq(tmp_now_n));

printf(“\nsigma(n’)/n’ = %.30Qf\n”, tmp_now_sigma_r);

printf(“record step is at: %ld\n”, RecordStep);

printf(“log(log(n’)) = %.30Qf “, log2nprime);

printf(“Robin upper bound = %.30Qf “, robin_bound);

printf(“sigma(n’)/n’ = %.30Qf \n”, tmp_now_quotient);

}
}

}

if(RecordStep < numprimes)
{
ptr_exponents[RecordStep]++;

p = pts_primes[RecordStep];

ptr_current_powers[RecordStep] = ptr_current_powers[RecordStep]*p;

ptr_current_sigmas[RecordStep] = ptr_current_sigmas[RecordStep]*p + ((long) 1);

}
if(RecordStep == numprimes)
{

if(num_new_primes < 79999500)
{

for(j=0; j< 100 ; j++)
{

sum_logs_primes = sum_logs_primes + logq( (__float128) ptr_primes[numprimes- file_offset]);

ratio = ((__float128)1)/((__float128)ptr_primes[numprimes-file_offset]);

if( RecordStep > 999999 )
{
numBigPrimesUsed++;
}

num_new_primes++;

prod_sigma_r = prod_sigma_r + (prod_sigma_r*ratio) ;

numprimes++;
}
}
else
{

sum_logs_primes = sum_logs_primes + logq( (__float128) ptr_primes[numprimes- file_offset]);

ratio = ((__float128)1)/((__float128)ptr_primes[numprimes-file_offset]);

if( RecordStep > 999999 )
{
numBigPrimesUsed++;
}

num_new_primes++;

prod_sigma_r = prod_sigma_r + (prod_sigma_r*ratio) ;

numprimes++;
}
skip_base_case = (int) 1;
}
else
{
skip_base_case = (int) 0;
}

if( 99999 == (numloops%100000) )
{
printf(“=================================\n”);
}
}
}

fclose(in);
/********************** Next batch 80 M and loop *******************/

/*****************************************************************
? primepi(99036319010)

%37 = 4080000000

4,080,000,000 primes included in `n’
in = fopen(“/home/david2/eratosthenes/LargePrimes_to_1e11ofNov22a.txt”, “r”);
**********************************************************************/
in = fopen(“/home/david2/eratosthenes2/LargePrimes_to_2e11ofNov26a.txt”, “r”);
for(kij = 1; kij < 50; kij++)
{

for(j=0; j< 80000000 ; j++)
{
fscanf(in, “%ld”, &ptr_primes[j]);
}

file_offset = file_offset + ((long)80000000) ;
num_new_primes = (long) 0;

numloops = (long) 0;

while( num_new_primes < ((long)80000000) )
{
numloops++;

ptr_isstep[0] = (long) 1;
list_steps[0] = (long) 0;
numsteps = (long) 1;
not_done = (int) 1;
j = (long) 0;

while(not_done == 1)
{
j++;

if(ptr_exponents[j]< ptr_exponents[j-1])
{
ptr_isstep[j] = (long) 1;
list_steps[numsteps] = j;
numsteps++;
}
else
{
ptr_isstep[j] = (long) 0;
}

if(ptr_exponents[j] == ((long) 1))
{
not_done = (int) 0;
}

}

list_steps[numsteps] = numprimes;
numsteps++;

if( 99999 == (numloops%100000) )
{
for(j=0; j< numsteps; j++)
{
printf(“step at %ld\n”, list_steps[j]+1);
}
printf(“\nNumber of big primes used in making current n is: %ld\n”, numBigPrimesUsed);
printf(“numloops = %ld\n”, numloops);
printf(“\n”);
}
if( 99999 == (numloops%100000) )
{
printf(“number of steps: %ld\n”, numsteps);
}
if( 99999 == (numloops%100000) )
{
for(j=0; j< 200 ; j++)
{
printf(“%ld “, ptr_exponents[j]);
}

printf(“\n”);
}

if( 799999 == (numloops%800000) )
{
printf(“record_low_variation_delta = %.30Qf “, record_low_variation_delta);
printf(“record_low_log2n = %.30Qf\n\n”, record_low_log2n);
fflush(stdout);

record_low_variation_delta = (__float128) 100;
record_low_log2n = (__float128) 0;
}

RecordRobinQuotient = (__float128) 0;
if(skip_base_case == 0)
{

base_tmp_now_n = (__float128) 0;

base_tmp_now_sigma_r = (__float128) 1;

now_step = (long) 0;

for(j=0; j<= list_steps[numsteps-2]; j++)
{
if(j == list_steps[now_step] )
{
now_step++;
}
else
{
base_tmp_now_n = base_tmp_now_n + ((__float128)ptr_exponents[j])*splogs[j];

powerb = ptr_current_powers[j];

sigma = ptr_current_sigmas[j];

ratio = ((__float128)sigma)/((__float128)powerb);
base_tmp_now_sigma_r = base_tmp_now_sigma_r*ratio;
}
}
}

sum_log_cofactor = sum_logs_primes;

prod_sigma_r_cofactor = prod_sigma_r;
sum_log_cofactor = sum_log_cofactor – theta[list_steps[numsteps-2]];

prod_sigma_r_cofactor = prod_sigma_r_cofactor/prod100k[list_steps[numsteps-2]];

for(m=0; m< numsteps ; m++)
{
current_step_number = m;

current_step = list_steps[m];

tmp_now_n = sum_log_cofactor + base_tmp_now_n;
tmp_now_sigma_r = base_tmp_now_sigma_r*prod_sigma_r_cofactor;
if(m < numsteps-((long)1) )
{

for(j=0; j<= numsteps- ((long)2) ; j++)
{
p = pts_primes[list_steps[j]];

if(j == m)
{
tmp_exponent = ptr_exponents[list_steps[j]] + ((long)1);
powerb = ptr_current_powers[list_steps[j]]*p;
sigma = ptr_current_sigmas[list_steps[j]]*p + ((long)1);
}
else
{
tmp_exponent = ptr_exponents[list_steps[j]];
powerb = ptr_current_powers[list_steps[j]];
sigma = ptr_current_sigmas[list_steps[j]];
}

tmp_now_n = tmp_now_n + ((__float128)tmp_exponent)*splogs[list_steps[j]];

ratio = ((__float128)sigma)/((__float128)powerb);
tmp_now_sigma_r = tmp_now_sigma_r*ratio;
}

tmp_now_quotient = tmp_now_sigma_r;

tmp_now_robin = tmp_now_quotient/expq(euler);

log2nprime = logq(tmp_now_n);

robin_bound = expq(euler)*log2nprime;

delta = robin_bound – tmp_now_quotient;

delta_log = logq(delta);

delta_estimate = constant – log2nprime/((__float128) 2);

variation_delta = delta_log – delta_estimate;

if( variation_delta < record_low_variation_delta)
{
record_low_variation_delta = variation_delta;
record_low_log2n = log2nprime;
}

tmp_el_now_robin = tmp_now_robin/logq(tmp_now_n);

tmp_now_robin = tmp_el_now_robin;

if(tmp_now_robin > RecordRobinQuotient)
{
RecordRobinQuotient = tmp_now_robin;
RecordStep = current_step;
}
if( 99999 == (numloops%100000) )
{

printf(“current step number = %ld “, current_step_number+1);

printf(“quotient de Robin: %.30Qf “, tmp_now_robin);

printf(“\nloglog n = %.30Qf\n”, logq(tmp_now_n));

printf(“\nsigma(n’)/n’ = %.30Qf\n”, tmp_now_sigma_r);
printf(“record step is at: %ld\n”, RecordStep+1);

printf(“log(log(n’)) = %.30Qf “, log2nprime);

printf(“Robin upper bound = %.30Qf “, robin_bound);

printf(“sigma(n’)/n’ = %.30Qf \n”, tmp_now_quotient);
}
}
else
{
for(j=0; j<= numsteps- ((long)2) ; j++)
{

tmp_exponent = ptr_exponents[list_steps[j]];

p = pts_primes[list_steps[j]];

tmp_now_n = tmp_now_n + ((__float128)tmp_exponent)*splogs[list_steps[j]];

powerb = ptr_current_powers[list_steps[j]];

sigma = ptr_current_sigmas[list_steps[j]];

ratio = ((__float128)sigma)/((__float128)powerb);

tmp_now_sigma_r = tmp_now_sigma_r*ratio;

}

tmp_now_n = tmp_now_n + logq((__float128) ptr_primes[current_step- file_offset]);
ratio = ((__float128)1)/( (__float128)ptr_primes[current_step- file_offset] );

tmp_now_sigma_r = tmp_now_sigma_r + (ratio*tmp_now_sigma_r) ;

tmp_now_quotient = tmp_now_sigma_r;
tmp_now_robin = tmp_now_quotient/expq(euler);
log2nprime = logq(tmp_now_n);
robin_bound = expq(euler)*log2nprime;

delta = robin_bound – tmp_now_quotient;

delta_log = logq(delta);

delta_estimate = constant – log2nprime/((__float128) 2);

variation_delta = delta_log – delta_estimate;

if( variation_delta < record_low_variation_delta)
{
record_low_variation_delta = variation_delta;
record_low_log2n = log2nprime;
}

tmp_el_now_robin = tmp_now_robin/logq(tmp_now_n);

tmp_now_robin = tmp_el_now_robin;
if(tmp_now_robin > RecordRobinQuotient)
{
RecordRobinQuotient = tmp_now_robin;
RecordStep = current_step;
}

if( 99999 == (numloops%100000) )
{
printf(“current step number = %ld “, current_step_number+1);

printf(“quotient de Robin: %.30Qf “, tmp_now_robin);

printf(“\nloglog n = %.30Qf\n”, logq(tmp_now_n));

printf(“\nsigma(n’)/n’ = %.30Qf\n”, tmp_now_sigma_r);

printf(“record step is at: %ld\n”, RecordStep+1);

printf(“log(log(n’)) = %.30Qf “, log2nprime);

printf(“Robin upper bound = %.30Qf “, robin_bound);

printf(“sigma(n’)/n’ = %.30Qf \n”, tmp_now_quotient);

}
}

}

if(RecordStep < numprimes)
{
ptr_exponents[RecordStep]++;
p = pts_primes[RecordStep];

ptr_current_powers[RecordStep] = ptr_current_powers[RecordStep]*p;

ptr_current_sigmas[RecordStep] = ptr_current_sigmas[RecordStep]*p + ((long) 1);

}
if(RecordStep == numprimes)
{

if(num_new_primes < 79999500)
{

for(j=0; j< 100 ; j++)
{

sum_logs_primes = sum_logs_primes + logq( (__float128) ptr_primes[numprimes- file_offset]);

ratio = ((__float128)1)/((__float128)ptr_primes[numprimes-file_offset]);

if( RecordStep > 999999 )
{
numBigPrimesUsed++;
}

num_new_primes++;

prod_sigma_r = prod_sigma_r + (prod_sigma_r*ratio) ;

numprimes++;
}
}
else
{

sum_logs_primes = sum_logs_primes + logq( (__float128) ptr_primes[numprimes- file_offset]);

ratio = ((__float128)1)/((__float128)ptr_primes[numprimes-file_offset]);

if( RecordStep > 999999 )
{
numBigPrimesUsed++;
}

num_new_primes++;

prod_sigma_r = prod_sigma_r + (prod_sigma_r*ratio) ;

numprimes++;
}
skip_base_case = (int) 1;
}
else
{
skip_base_case = (int) 0;
}

if( 99999 == (numloops%100000) )
{
printf(“=================================\n”);
}
}
}

fclose(in);
/*****************************************************************
? primepi(99036319010)

%37 = 4080000000

4,080,000,000 primes included in `n’
in = fopen(“/home/david2/eratosthenes/LargePrimes_to_1e11ofNov22a.txt”, “r”);
Now, after another 49 batches of 80,000,000

we have done:

3,920,000,000 + 4,080,000,000 =

8,000,000,000 primes included in `n’

37,607,912,018 primes below 10^12 .

370 batches of 80 million

**********************************************************************/
for(kijj = 1; kijj <= 370 ; kijj++)
{

sivcount_new_primes = (long) 0;
sivbatchdone = 0;

while( (sivcount_new_primes < 80000000) && (sivbatchdone == 0) )
{

sivblockprimecount = (long) 0;

for(sivj=0; sivj< sivblock_size; sivj++)
{
sivptr_remains[sivj] = sivuc1;
}

for(sivj=0; sivj< 78498; sivj++)
{
sivp = sivsmall_primes[sivj];
sivrem = sivoffset%sivp;

if(sivrem == 0)
{
sivbarred = sivoffset;
}
else
{
sivbarred = sivoffset + sivp – sivrem;
}

sivindex = sivbarred – sivoffset;

while(sivindex< sivblock_size)
{
sivptr_remains[sivindex] = sivuc0;
sivindex = sivindex+sivp;
}
}

for(sivj=0; sivj< sivblock_size; sivj++)
{
if( sivptr_remains[sivj] == sivuc1 )
{
sivcount++;
sivcount_new_primes++;
sivblockprimecount++;
if(sivcount_new_primes <= 80000000)
{
ptr_primes[sivcount_new_primes – 1] = sivoffset + sivj ;
}
}
}

if(sivcount_new_primes >= 80000000 )
{
sivbatchdone = 1;
siv_left_overs = sivcount_new_primes – 80000000;
siv_keeps = sivblockprimecount – siv_left_overs;
sivp_num = (long) 0;

for(sivj=0; sivj< sivblock_size; sivj++)
{
if(sivptr_remains[sivj] == sivuc1 )
{
sivp_num++;
if(sivp_num == siv_keeps)
{
siv_last_sivj = sivj;
}
}
}
sivoffset_next = sivoffset + siv_last_sivj + ((long) 1);
sivoffset = sivoffset_next;
}
else
{
sivoffset = sivoffset + sivblock_size;
}
}
if( kijj == 1 )
{

out=fopen(“/home/david2/eratosthenes6/batchp001a.txt”, “w”);

for(j=0; j< 80000000 ; j++)
{
fprintf(out, “%ld\n”, ptr_primes[j]);
}

fclose(out);
}
file_offset = file_offset + ((long)80000000) ;
num_new_primes = (long) 0;

numloops = (long) 0;
while( num_new_primes < ((long)80000000) )
{
numloops++;

ptr_isstep[0] = (long) 1;
list_steps[0] = (long) 0;
numsteps = (long) 1;
not_done = (int) 1;
j = (long) 0;

while(not_done == 1)
{
j++;

if(ptr_exponents[j]< ptr_exponents[j-1])
{
ptr_isstep[j] = (long) 1;
list_steps[numsteps] = j;
numsteps++;
}
else
{
ptr_isstep[j] = (long) 0;
}

if(ptr_exponents[j] == ((long) 1))
{
not_done = (int) 0;
}

}

list_steps[numsteps] = numprimes;
numsteps++;

if( 99999 == (numloops%100000) )
{
for(j=0; j< numsteps; j++)
{
printf(“step at %ld\n”, list_steps[j]+1);
}
printf(“\nNumber of big primes used in making current n is: %ld\n”, numBigPrimesUsed);
printf(“numloops = %ld\n”, numloops);
printf(“\n”);
}
if( 99999 == (numloops%100000) )
{
printf(“number of steps: %ld\n”, numsteps);
}
if( 99999 == (numloops%100000) )
{
for(j=0; j< 200 ; j++)
{
printf(“%ld “, ptr_exponents[j]);
}

printf(“\n”);
}

if( 799999 == (numloops%800000) )
{
printf(“\n\nrecord_low_variation_delta = %.30Qf “, record_low_variation_delta);
printf(“record_low_log2n = %.30Qf\n\n”, record_low_log2n);
fflush(stdout);
record_low_variation_delta = (__float128) 100;
record_low_log2n = (__float128) 0;
}

RecordRobinQuotient = (__float128) 0;
if(skip_base_case == 0)
{

base_tmp_now_n = (__float128) 0;

base_tmp_now_sigma_r = (__float128) 1;

now_step = (long) 0;

for(j=0; j<= list_steps[numsteps-2]; j++)
{
if(j == list_steps[now_step] )
{
now_step++;
}
else
{
base_tmp_now_n = base_tmp_now_n + ((__float128)ptr_exponents[j])*splogs[j];

powerb = ptr_current_powers[j];

sigma = ptr_current_sigmas[j];

ratio = ((__float128)sigma)/((__float128)powerb);
base_tmp_now_sigma_r = base_tmp_now_sigma_r*ratio;
}

}
}

sum_log_cofactor = sum_logs_primes;

prod_sigma_r_cofactor = prod_sigma_r;
sum_log_cofactor = sum_log_cofactor – theta[list_steps[numsteps-2]];

prod_sigma_r_cofactor = prod_sigma_r_cofactor/prod100k[list_steps[numsteps-2]];

for(m=0; m< numsteps ; m++)
{
current_step_number = m;

current_step = list_steps[m];

tmp_now_n = sum_log_cofactor + base_tmp_now_n;
tmp_now_sigma_r = base_tmp_now_sigma_r*prod_sigma_r_cofactor;
if(m < numsteps-((long)1) )
{

for(j=0; j<= numsteps- ((long)2) ; j++)
{
p = pts_primes[list_steps[j]];

if(j == m)
{
tmp_exponent = ptr_exponents[list_steps[j]] + ((long)1);
powerb = ptr_current_powers[list_steps[j]]*p;
sigma = ptr_current_sigmas[list_steps[j]]*p + ((long)1);
}
else
{
tmp_exponent = ptr_exponents[list_steps[j]];
powerb = ptr_current_powers[list_steps[j]];
sigma = ptr_current_sigmas[list_steps[j]];
}

tmp_now_n = tmp_now_n + ((__float128)tmp_exponent)*splogs[list_steps[j]];

ratio = ((__float128)sigma)/((__float128)powerb);
tmp_now_sigma_r = tmp_now_sigma_r*ratio;
}

tmp_now_quotient = tmp_now_sigma_r;

tmp_now_robin = tmp_now_quotient/expq(euler);

log2nprime = logq(tmp_now_n);

robin_bound = expq(euler)*log2nprime;

delta = robin_bound – tmp_now_quotient;

delta_log = logq(delta);

delta_estimate = constant – log2nprime/((__float128) 2);

variation_delta = delta_log – delta_estimate;

if( variation_delta < record_low_variation_delta)
{
record_low_variation_delta = variation_delta;
record_low_log2n = log2nprime;
}

tmp_el_now_robin = tmp_now_robin/logq(tmp_now_n);

tmp_now_robin = tmp_el_now_robin;

if(tmp_now_robin > RecordRobinQuotient)
{
RecordRobinQuotient = tmp_now_robin;
RecordStep = current_step;
}
if( 99999 == (numloops%100000) )
{

printf(“current step number = %ld “, current_step_number+1);

printf(“quotient de Robin: %.30Qf “, tmp_now_robin);

printf(“\nloglog n = %.30Qf\n”, logq(tmp_now_n));

printf(“\nsigma(n’)/n’ = %.30Qf\n”, tmp_now_sigma_r);
printf(“record step is at: %ld\n”, RecordStep+1);

printf(“log(log(n’)) = %.30Qf “, log2nprime);

printf(“Robin upper bound = %.30Qf “, robin_bound);

printf(“sigma(n’)/n’ = %.30Qf \n”, tmp_now_quotient);
}
}
else
{
for(j=0; j<= numsteps- ((long)2) ; j++)
{

tmp_exponent = ptr_exponents[list_steps[j]];

p = pts_primes[list_steps[j]];

tmp_now_n = tmp_now_n + ((__float128)tmp_exponent)*splogs[list_steps[j]];

powerb = ptr_current_powers[list_steps[j]];

sigma = ptr_current_sigmas[list_steps[j]];

ratio = ((__float128)sigma)/((__float128)powerb);

tmp_now_sigma_r = tmp_now_sigma_r*ratio;

}

tmp_now_n = tmp_now_n + logq((__float128) ptr_primes[current_step- file_offset]);
ratio = ((__float128)1)/( (__float128)ptr_primes[current_step- file_offset] );

tmp_now_sigma_r = tmp_now_sigma_r + (ratio*tmp_now_sigma_r) ;

tmp_now_quotient = tmp_now_sigma_r;
tmp_now_robin = tmp_now_quotient/expq(euler);
log2nprime = logq(tmp_now_n);
robin_bound = expq(euler)*log2nprime;

delta = robin_bound – tmp_now_quotient;

delta_log = logq(delta);

delta_estimate = constant – log2nprime/((__float128) 2);

variation_delta = delta_log – delta_estimate;

if( variation_delta < record_low_variation_delta)
{
record_low_variation_delta = variation_delta;
record_low_log2n = log2nprime;
}

tmp_el_now_robin = tmp_now_robin/logq(tmp_now_n);

tmp_now_robin = tmp_el_now_robin;
if(tmp_now_robin > RecordRobinQuotient)
{
RecordRobinQuotient = tmp_now_robin;
RecordStep = current_step;
}

if( 99999 == (numloops%100000) )
{
printf(“current step number = %ld “, current_step_number+1);

printf(“quotient de Robin: %.30Qf “, tmp_now_robin);

printf(“\nloglog n = %.30Qf\n”, logq(tmp_now_n));

printf(“\nsigma(n’)/n’ = %.30Qf\n”, tmp_now_sigma_r);

printf(“record step is at: %ld\n”, RecordStep+1);

printf(“log(log(n’)) = %.30Qf “, log2nprime);

printf(“Robin upper bound = %.30Qf “, robin_bound);

printf(“sigma(n’)/n’ = %.30Qf \n”, tmp_now_quotient);

}
}

}

if(RecordStep < numprimes)
{
ptr_exponents[RecordStep]++;

p = pts_primes[RecordStep];

ptr_current_powers[RecordStep] = ptr_current_powers[RecordStep]*p;

ptr_current_sigmas[RecordStep] = ptr_current_sigmas[RecordStep]*p + ((long) 1);
}
if(RecordStep == numprimes)
{

if(num_new_primes < 79999500)
{

for(j=0; j< 100 ; j++)
{

sum_logs_primes = sum_logs_primes + logq( (__float128) ptr_primes[numprimes- file_offset]);

ratio = ((__float128)1)/((__float128)ptr_primes[numprimes-file_offset]);

if( RecordStep > 999999 )
{
numBigPrimesUsed++;
}

num_new_primes++;

prod_sigma_r = prod_sigma_r + (prod_sigma_r*ratio) ;

numprimes++;
}
}
else
{

sum_logs_primes = sum_logs_primes + logq( (__float128) ptr_primes[numprimes- file_offset]);

ratio = ((__float128)1)/((__float128)ptr_primes[numprimes-file_offset]);

if( RecordStep > 999999 )
{
numBigPrimesUsed++;
}

num_new_primes++;

prod_sigma_r = prod_sigma_r + (prod_sigma_r*ratio) ;

numprimes++;
}
skip_base_case = (int) 1;
}
else
{
skip_base_case = (int) 0;
}

if( 99999 == (numloops%100000) )
{
printf(“=================================\n”);
}
}

}
/*****************************************************************
? primepi(99036319010)

%37 = 4080000000

4,080,000,000 primes included in `n’
in = fopen(“/home/david2/eratosthenes/LargePrimes_to_1e11ofNov22a.txt”, “r”);
Now, after another 49 batches of 80,000,000

we have done:

3,920,000,000 + 4,080,000,000 =

8,000,000,000 primes included in `n’

37,607,912,018 primes below 10^12 .

370 batches of 80 million
above is done already.
Now,
470 batches of 80 million have been completed.
about 37,600,000,000 primes included in `n’ ,

i.e. below just under 10^12.

Next, go to 4*10^12
Nicely:

pi(4e+12) ~= 142,966,208,126

1787 bacthes in all.

470 batches are done.

1317 batches remain to be done.

Use sieving for first 150,000 primes to cover
numbers below 4e+12 for primality testing.

9 December 2014

6:15 pm
**********************************************************************/
for(kijj = 1; kijj <= 1317 ; kijj++)
{

sivcount_new_primes = (long) 0;
sivbatchdone = 0;

while( (sivcount_new_primes < 80000000) && (sivbatchdone == 0) )
{

sivblockprimecount = (long) 0;

for(sivj=0; sivj< sivblock_size; sivj++)
{
sivptr_remains[sivj] = sivuc1;
}

for(sivj=0; sivj< 150000 ; sivj++)
{
sivp = sivsmall_primes[sivj];
sivrem = sivoffset%sivp;

if(sivrem == 0)
{
sivbarred = sivoffset;
}
else
{
sivbarred = sivoffset + sivp – sivrem;
}

sivindex = sivbarred – sivoffset;

while(sivindex< sivblock_size)
{
sivptr_remains[sivindex] = sivuc0;
sivindex = sivindex+sivp;
}
}

for(sivj=0; sivj< sivblock_size; sivj++)
{
if( sivptr_remains[sivj] == sivuc1 )
{
sivcount++;
sivcount_new_primes++;
sivblockprimecount++;
if(sivcount_new_primes <= 80000000)
{
ptr_primes[sivcount_new_primes – 1] = sivoffset + sivj ;
}
}
}

if(sivcount_new_primes >= 80000000 )
{
sivbatchdone = 1;
siv_left_overs = sivcount_new_primes – 80000000;
siv_keeps = sivblockprimecount – siv_left_overs;
sivp_num = (long) 0;

for(sivj=0; sivj< sivblock_size; sivj++)
{
if(sivptr_remains[sivj] == sivuc1 )
{
sivp_num++;
if(sivp_num == siv_keeps)
{
siv_last_sivj = sivj;
}
}
}
sivoffset_next = sivoffset + siv_last_sivj + ((long) 1);
sivoffset = sivoffset_next;
}
else
{
sivoffset = sivoffset + sivblock_size;
}
}
if( kijj == 1 )
{

out=fopen(“/home/david2/eratosthenes6/batchp002a.txt”, “w”);

for(j=0; j< 80000000 ; j++)
{
fprintf(out, “%ld\n”, ptr_primes[j]);
}

fclose(out);
}
file_offset = file_offset + ((long)80000000) ;
num_new_primes = (long) 0;

numloops = (long) 0;
while( num_new_primes < ((long)80000000) )
{
numloops++;

ptr_isstep[0] = (long) 1;
list_steps[0] = (long) 0;
numsteps = (long) 1;
not_done = (int) 1;
j = (long) 0;

while(not_done == 1)
{
j++;

if(ptr_exponents[j]< ptr_exponents[j-1])
{
ptr_isstep[j] = (long) 1;
list_steps[numsteps] = j;
numsteps++;
}
else
{
ptr_isstep[j] = (long) 0;
}

if(ptr_exponents[j] == ((long) 1))
{
not_done = (int) 0;
}

}

list_steps[numsteps] = numprimes;
numsteps++;

if( 99999 == (numloops%100000) )
{
for(j=0; j< numsteps; j++)
{
printf(“step at %ld\n”, list_steps[j]+1);
}
printf(“\nNumber of big primes used in making current n is: %ld\n”, numBigPrimesUsed);
printf(“numloops = %ld\n”, numloops);
printf(“\n”);
}
if( 99999 == (numloops%100000) )
{
printf(“number of steps: %ld\n”, numsteps);
}
if( 99999 == (numloops%100000) )
{
for(j=0; j< 200 ; j++)
{
printf(“%ld “, ptr_exponents[j]);
}

printf(“\n”);
}

if( 399999 == (numloops%400000) )
{
printf(“\n\nrecord_low_variation_delta = %.30Qf “, record_low_variation_delta);
printf(“record_low_log2n = %.30Qf\n\n”, record_low_log2n);
fflush(stdout);
record_low_variation_delta = (__float128) 100;
record_low_log2n = (__float128) 0;
}

RecordRobinQuotient = (__float128) 0;
if(skip_base_case == 0)
{

base_tmp_now_n = (__float128) 0;

base_tmp_now_sigma_r = (__float128) 1;

now_step = (long) 0;

for(j=0; j<= list_steps[numsteps-2]; j++)
{
if(j == list_steps[now_step] )
{
now_step++;
}
else
{
base_tmp_now_n = base_tmp_now_n + ((__float128)ptr_exponents[j])*splogs[j];

powerb = ptr_current_powers[j];

sigma = ptr_current_sigmas[j];

ratio = ((__float128)sigma)/((__float128)powerb);
base_tmp_now_sigma_r = base_tmp_now_sigma_r*ratio;
}
}
}

sum_log_cofactor = sum_logs_primes;

prod_sigma_r_cofactor = prod_sigma_r;
sum_log_cofactor = sum_log_cofactor – theta[list_steps[numsteps-2]];

prod_sigma_r_cofactor = prod_sigma_r_cofactor/prod100k[list_steps[numsteps-2]];

for(m=0; m< numsteps ; m++)
{
current_step_number = m;

current_step = list_steps[m];

tmp_now_n = sum_log_cofactor + base_tmp_now_n;
tmp_now_sigma_r = base_tmp_now_sigma_r*prod_sigma_r_cofactor;
if(m < numsteps-((long)1) )
{

for(j=0; j<= numsteps- ((long)2) ; j++)
{
p = pts_primes[list_steps[j]];

if(j == m)
{
tmp_exponent = ptr_exponents[list_steps[j]] + ((long)1);
powerb = ptr_current_powers[list_steps[j]]*p;
sigma = ptr_current_sigmas[list_steps[j]]*p + ((long)1);
}
else
{
tmp_exponent = ptr_exponents[list_steps[j]];
powerb = ptr_current_powers[list_steps[j]];
sigma = ptr_current_sigmas[list_steps[j]];
}

tmp_now_n = tmp_now_n + ((__float128)tmp_exponent)*splogs[list_steps[j]];

ratio = ((__float128)sigma)/((__float128)powerb);
tmp_now_sigma_r = tmp_now_sigma_r*ratio;
}
tmp_now_quotient = tmp_now_sigma_r;

tmp_now_robin = tmp_now_quotient/expq(euler);

log2nprime = logq(tmp_now_n);

robin_bound = expq(euler)*log2nprime;

delta = robin_bound – tmp_now_quotient;

delta_log = logq(delta);

delta_estimate = constant – log2nprime/((__float128) 2);

variation_delta = delta_log – delta_estimate;

if( variation_delta < record_low_variation_delta)
{
record_low_variation_delta = variation_delta;
record_low_log2n = log2nprime;
}

tmp_el_now_robin = tmp_now_robin/logq(tmp_now_n);

tmp_now_robin = tmp_el_now_robin;

if(tmp_now_robin > RecordRobinQuotient)
{
RecordRobinQuotient = tmp_now_robin;
RecordStep = current_step;
}
if( 99999 == (numloops%100000) )
{

printf(“current step number = %ld “, current_step_number+1);

printf(“quotient de Robin: %.30Qf “, tmp_now_robin);

printf(“\nloglog n = %.30Qf\n”, logq(tmp_now_n));

printf(“\nsigma(n’)/n’ = %.30Qf\n”, tmp_now_sigma_r);
printf(“record step is at: %ld\n”, RecordStep+1);

printf(“log(log(n’)) = %.30Qf “, log2nprime);

printf(“Robin upper bound = %.30Qf “, robin_bound);

printf(“sigma(n’)/n’ = %.30Qf \n”, tmp_now_quotient);
}
}
else
{

for(j=0; j<= numsteps- ((long)2) ; j++)
{

tmp_exponent = ptr_exponents[list_steps[j]];

p = pts_primes[list_steps[j]];

tmp_now_n = tmp_now_n + ((__float128)tmp_exponent)*splogs[list_steps[j]];

powerb = ptr_current_powers[list_steps[j]];

sigma = ptr_current_sigmas[list_steps[j]];

ratio = ((__float128)sigma)/((__float128)powerb);

tmp_now_sigma_r = tmp_now_sigma_r*ratio;

}

tmp_now_n = tmp_now_n + logq((__float128) ptr_primes[current_step- file_offset]);
ratio = ((__float128)1)/( (__float128)ptr_primes[current_step- file_offset] );

tmp_now_sigma_r = tmp_now_sigma_r + (ratio*tmp_now_sigma_r) ;

tmp_now_quotient = tmp_now_sigma_r;
tmp_now_robin = tmp_now_quotient/expq(euler);
log2nprime = logq(tmp_now_n);
robin_bound = expq(euler)*log2nprime;

delta = robin_bound – tmp_now_quotient;

delta_log = logq(delta);

delta_estimate = constant – log2nprime/((__float128) 2);

variation_delta = delta_log – delta_estimate;

if( variation_delta < record_low_variation_delta)
{
record_low_variation_delta = variation_delta;
record_low_log2n = log2nprime;
}

tmp_el_now_robin = tmp_now_robin/logq(tmp_now_n);

tmp_now_robin = tmp_el_now_robin;
if(tmp_now_robin > RecordRobinQuotient)
{
RecordRobinQuotient = tmp_now_robin;
RecordStep = current_step;
}

if( 99999 == (numloops%100000) )
{
printf(“current step number = %ld “, current_step_number+1);

printf(“quotient de Robin: %.30Qf “, tmp_now_robin);

printf(“\nloglog n = %.30Qf\n”, logq(tmp_now_n));

printf(“\nsigma(n’)/n’ = %.30Qf\n”, tmp_now_sigma_r);

printf(“record step is at: %ld\n”, RecordStep+1);

printf(“log(log(n’)) = %.30Qf “, log2nprime);

printf(“Robin upper bound = %.30Qf “, robin_bound);

printf(“sigma(n’)/n’ = %.30Qf \n”, tmp_now_quotient);

}
}

}

if(RecordStep < numprimes)
{
ptr_exponents[RecordStep]++;

p = pts_primes[RecordStep];

ptr_current_powers[RecordStep] = ptr_current_powers[RecordStep]*p;

ptr_current_sigmas[RecordStep] = ptr_current_sigmas[RecordStep]*p + ((long) 1);

}
if(RecordStep == numprimes)
{

if(num_new_primes < 79999500)
{

for(j=0; j< 200 ; j++)
{

sum_logs_primes = sum_logs_primes + logq( (__float128) ptr_primes[numprimes- file_offset]);

ratio = ((__float128)1)/((__float128)ptr_primes[numprimes-file_offset]);

if( RecordStep > 999999 )
{
numBigPrimesUsed++;
}

num_new_primes++;

prod_sigma_r = prod_sigma_r + (prod_sigma_r*ratio) ;

numprimes++;
}
}
else
{

sum_logs_primes = sum_logs_primes + logq( (__float128) ptr_primes[numprimes- file_offset]);

ratio = ((__float128)1)/((__float128)ptr_primes[numprimes-file_offset]);

if( RecordStep > 999999 )
{
numBigPrimesUsed++;
}

num_new_primes++;

prod_sigma_r = prod_sigma_r + (prod_sigma_r*ratio) ;

numprimes++;
}
skip_base_case = (int) 1;
}
else
{
skip_base_case = (int) 0;
}

if( 99999 == (numloops%100000) )
{
printf(“=================================\n”);
}
}

}
return 0;
}

Advertisements

Written by meditationatae

January 3, 2015 at 11:33 am

Posted in History

%d bloggers like this: