Thread: Using gfndsieve
View Single Post
Old 2019-01-28, 12:37   #2
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

25×149 Posts
Default

Quote:
Originally Posted by houding View Post
I've started to look into using gfndsieve, because it is multi-threaded.


I have a question. Not a problem with the program, just curious.



When I start a sieve, it will say "expecting 192048 factors".

[...]

How is the expecting calculated? Or is it just a guess that for a given amount of numbers in a range so many could be factors after others have been eliminated because they are even numbers?
If you dive into the source code, you will find a formula that calculates the approximate numbers of possible factors in a range.

At line 212 of FactorApp.cpp you will find:

Code:
 
   if (il_MaxPrime != il_AppMaxPrime)
   {
      double expectedFactors = il_TermCount * (1 - log(il_MinPrime) / log (il_MaxPrime));
   
      sprintf(endOfMessage, "expecting %.f factors", expectedFactors);
   }
ET_ is offline   Reply With Quote