![]() |
![]() |
#1079 | |
"Mark"
Apr 2003
Between here and the
2·32·401 Posts |
![]() Quote:
I'm sure it isn't perfect. |
|
![]() |
![]() |
![]() |
#1080 | ||
Random Account
Aug 2009
Not U. + S.A.
53038 Posts |
![]() Quote:
Quote:
Code:
...22 factors found at 214 cpu sec per factor... |
||
![]() |
![]() |
![]() |
#1081 |
Jun 2003
1,621 Posts |
![]()
Is it possible in the next release we could have a command line option to limit primes being tested to certain classes (similar to pfgw -f{n,+-1}). The program currently does not automatically catch these.
Thanks. Last fiddled with by Citrix on 2023-03-26 at 21:42 Reason: Typo |
![]() |
![]() |
![]() |
#1082 |
Just call me Henry
"David"
Sep 2007
Liverpool (GMT/BST)
11·557 Posts |
![]()
It would also be nice to be able to see the sec/factor for shorter periods than from the start. Starting a sieve and then looking at average sec/factor makes no sense.
p/sec also seems to be based on time elapsed rather than cpu seconds. Some consistency would make sense. |
![]() |
![]() |
![]() |
#1083 | |
"Mark"
Apr 2003
Between here and the
2·32·401 Posts |
![]() Quote:
This could be a fairly major effort. |
|
![]() |
![]() |
![]() |
#1084 | |
"Mark"
Apr 2003
Between here and the
2×32×401 Posts |
![]() Quote:
If you have ideas on computing a better average, please share them. As for p/sec, I see what you mean. It shouldn't be too hard to adjust. |
|
![]() |
![]() |
![]() |
#1085 | |
Jun 2003
1,621 Posts |
![]() Quote:
The changes would only require a few lines of code. We only need to filter out where p%n belongs to certain classes. The sieve of Eratosthenes code does not need to rewritten. If n=2^x then the modulus step can be even faster If n is extremely smooth (ex 5 smooth) then the modulus step can be fast as well. |
|
![]() |
![]() |
![]() |
#1086 | |
Just call me Henry
"David"
Sep 2007
Liverpool (GMT/BST)
11·557 Posts |
![]() Quote:
Something like the last 100 factors would make sense to me(configurable). Something like a std::deque would make it fairly easy to store the cpu time for the last x factors. My only concern is that this could be a bit dodgy when factors are being found very quickly near the beginning of a sieve. Maybe more factors should be considered then; however, the rate of factor finding will be changing rapidly then anyway so it probably doesn't matter too much. Another option would be to report an expected sec/f based on recent p/sec. That would require the estimated f/p to be accurate. Some of the current sieves don't give accurate estimates for the number of factors. For example, I think last time I used ccsieve, it didn't adjust estimates for sieving multiple terms per candidate. |
|
![]() |
![]() |
![]() |
#1087 |
"Mark"
Apr 2003
Between here and the
2·32·401 Posts |
![]()
Citrix, if you have some code, send it my way and I will take a look at how to best integrate it.
henryzz, I might be able to do something along the line of what you suggested, i.e. track rate for the last xx factors as opposed to the last xx minutes, but I don't think that solves the problem. When one starts a new sieve p/sec is lower due to factor validation and other overhead associated with removing candidates due to a factor. I think that the best option (whatever that option is) would require saving runtime and factor removal details in a file so that upon restart it could read from that file and continue as if the program was not stopped and restarted. Since you have some concrete ideas regarding the calculation, would you mind experimenting with the code to find an algorithm that computes the rate in a way that makes more sense? ccsieve and twinsieve both miscalculate since candidates can be removed "more than one way" for each p. If you have ideas on how to better compute the number of candidates to be removed for those sieves, please share. |
![]() |
![]() |
![]() |
#1088 | ||||
Just call me Henry
"David"
Sep 2007
Liverpool (GMT/BST)
11·557 Posts |
![]() Quote:
Quote:
Quote:
Quote:
I have limitted time to spend on this so it may take a little while to get around to implementing everything. My aim for my siever is to support a number of different techniques for finding/removing factors so I can compare them in different situations. Tuple sieves can become very sparse which means a sieve array is not ideal but a list of candidates can take time checking if a candidate remains as well. |
||||
![]() |
![]() |
![]() |
#1089 | |
Jun 2003
1,621 Posts |
![]() Quote:
1. Get n from command line and classes to be tested (generally +1 or -1 or both); (if n is 2 all primes need to be tested and we do not need to filter as all primes are odd; 2 is the default value) 2. The location where il_PrimeList is initialized with primes we can insert the following lines of code to filter the primes. (p is current prime) Code:
while (prime<max) { if (n>2 && (p%n==+1 || p%n==-1)) {Enter this prime in the array} else {skip this prime and go to next prime from iterator} } |
|
![]() |
![]() |