Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a faster series for calculating the Riemann R function #144

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/primesieve/forward.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace primesieve {

extern const Array<uint64_t, 65> bitValues;
extern const Array<uint64_t, 64> bruijnBitValues;
extern const Array<long double, 128> zetaInv;

int get_num_threads();
int get_sieve_size();
Expand Down
3 changes: 0 additions & 3 deletions include/primesieve/nthPrimeApprox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

namespace primesieve {

Vector<int32_t> generate_moebius(int64_t max);
uint64_t Li(uint64_t x);
uint64_t Li_inverse(uint64_t x);
uint64_t Ri(uint64_t x);
uint64_t Ri_inverse(uint64_t x);
uint64_t primePiApprox(uint64_t x);
Expand Down
136 changes: 136 additions & 0 deletions src/LookupTables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,140 @@ const WheelInit wheel210Init[210] =
{ 1, 47 }, { 0, 47 }
};

/// Precomputed values of zetaInv[k] = 1 / zeta(k + 1).
/// Used in the calculation of the Riemann R function and its derivative.
/// These values are calculated up to a precision of 128 bits.
///
const Array<long double, 128> zetaInv =
{
0.00000000000000000000000000000000000000L,
0.60792710185402662866327677925836583343L,
0.83190737258070746868312627882153073442L,
0.92393840292159016702375049404068247277L,
0.96438734042926245912643658844498457124L,
0.98295259226458041980489656499392413295L,
0.99171985583844431042818593149755069165L,
0.99593920112551514683483647280554532401L,
0.99799563273076215686467613210509999632L,
0.99900641306903078175222531809290878576L,
0.99950605549762467678582298009453697739L,
0.99975397399038468206770164303673058471L,
0.99987730170913952450133620378723676486L,
0.99993875561604559519730175829325041151L,
0.99996941269930456117242340889418930870L,
0.99998471797413523168338429153076556171L,
0.99999236286068844254826438672217335846L,
0.99999618272130667240681034896437598819L,
0.99999809179092471488437703328457254051L,
0.99999904603887616989781139055273723228L,
0.99999952306724067715893767591651988929L,
0.99999976154955413089570313635363076685L,
0.99999988078008824807797958727410486625L,
0.99999994039181450187651056224846508482L,
0.99999997019649737359651508890102089892L,
0.99999998509844539369129175912634580637L,
0.99999999254928826567767626959951349247L,
0.99999999627466598908965648972675175642L,
0.99999999813734027995645223273129800534L,
0.99999999906867256844770260269784066458L,
0.99999999953433709371346353509327556591L,
0.99999999976716881668655981073561305391L,
0.99999999988358449828654737128147523751L,
0.99999999994179227912436112987729664108L,
0.99999999997089614955587603724140433426L,
0.99999999998544807810916977419479027320L,
0.99999999999272404016499545857700011549L,
0.99999999999636202045263458370494986090L,
0.99999999999818101034969624277576308610L,
0.99999999999909050521597443825250885864L,
0.99999999999954525262169599139249816326L,
0.99999999999977262631541758644726975846L,
0.99999999999988631315923199013976285333L,
0.99999999999994315658012372737508161143L,
0.99999999999997157829023110778923903545L,
0.99999999999998578914517196859517856066L,
0.99999999999999289457260478919777422111L,
0.99999999999999644728630866289894847613L,
0.99999999999999822364315642088282797029L,
0.99999999999999911182157890691919855133L,
0.99999999999999955591078968561886079545L,
0.99999999999999977795539492019585090391L,
0.99999999999999988897769748589339895390L,
0.99999999999999994448884875154519064428L,
0.99999999999999997224442437863875904455L,
0.99999999999999998612221219027476742979L,
0.99999999999999999306110609545584635070L,
0.99999999999999999653055304783407738733L,
0.99999999999999999826527652395242343096L,
0.99999999999999999913263826198800662795L,
0.99999999999999999956631913099793495144L,
0.99999999999999999978315956550027802158L,
0.99999999999999999989157978275057585938L,
0.99999999999999999994578989137543354593L,
0.99999999999999999997289494568776531168L,
0.99999999999999999998644747284389883546L,
0.99999999999999999999322373642195481090L,
0.99999999999999999999661186821097920322L,
0.99999999999999999999830593410549020083L,
0.99999999999999999999915296705274530021L,
0.99999999999999999999957648352637271666L,
0.99999999999999999999978824176318638057L,
0.99999999999999999999989412088159319766L,
0.99999999999999999999994706044079660134L,
0.99999999999999999999997353022039830147L,
0.99999999999999999999998676511019915106L,
0.99999999999999999999999338255509957560L,
0.99999999999999999999999669127754978787L,
0.99999999999999999999999834563877489392L,
0.99999999999999999999999917281938744701L,
0.99999999999999999999999958640969372348L,
0.99999999999999999999999979320484686179L,
0.99999999999999999999999989660242343087L,
0.99999999999999999999999994830121171549L,
0.99999999999999999999999997415060585772L,
0.99999999999999999999999998707530292891L,
0.99999999999999999999999999353765146443L,
0.99999999999999999999999999676882573227L,
0.99999999999999999999999999838441286611L,
0.99999999999999999999999999919220643311L,
0.99999999999999999999999999959610321653L,
0.99999999999999999999999999979805160832L,
0.99999999999999999999999999989902580413L,
0.99999999999999999999999999994951290212L,
0.99999999999999999999999999997475645103L,
0.99999999999999999999999999998737822558L,
0.99999999999999999999999999999368911276L,
0.99999999999999999999999999999684455644L,
0.99999999999999999999999999999842227819L,
0.99999999999999999999999999999921113916L,
0.99999999999999999999999999999960556955L,
0.99999999999999999999999999999980278483L,
0.99999999999999999999999999999990139239L,
0.99999999999999999999999999999995069626L,
0.99999999999999999999999999999997534810L,
0.99999999999999999999999999999998767411L,
0.99999999999999999999999999999999383702L,
0.99999999999999999999999999999999691858L,
0.99999999999999999999999999999999845926L,
0.99999999999999999999999999999999922970L,
0.99999999999999999999999999999999961481L,
0.99999999999999999999999999999999980747L,
0.99999999999999999999999999999999990370L,
0.99999999999999999999999999999999995192L,
0.99999999999999999999999999999999997593L,
0.99999999999999999999999999999999998803L,
0.99999999999999999999999999999999999398L,
0.99999999999999999999999999999999999706L,
0.99999999999999999999999999999999999850L,
0.99999999999999999999999999999999999932L,
0.99999999999999999999999999999999999962L,
0.99999999999999999999999999999999999989L,
0.99999999999999999999999999999999999991L,
1.00000000000000000000000000000000000000L,
1.00000000000000000000000000000000000000L,
1.00000000000000000000000000000000000000L,
1.00000000000000000000000000000000000000L,
1.00000000000000000000000000000000000000L
};

} // namespace
Loading