![]() |
[QUOTE=LaurV;269877]Already did that, sieving since. Figured by myself the part with "-R" (didn't know small r works too). See my reply there. Thanks both of you.[/QUOTE]
Actually, there is a difference between "-R" and "-r"... sorry for the confusion. -R tells yafu to resume a job, while -r tells it to lattice sieve on the rational side (as opposed to the algebraic side.) The polynomial is pretty well balanced, so it might not make much difference which side you sieve on, but I guessed that -r would be slightly faster. In any case, you're welcome. The [URL="http://www.mersennewiki.org/index.php/SNFS_Polynomial_Selection"]mersenne wiki [/URL]has some of the basics of SNFS poly selection, and just browsing around some of the popular factoring forum threads might be the next best place to learn about it. |
I improved my Perl script a bit. I found some errors during my long tests:
- sometimes YAFU finds composites, these now also fetched and reported - it is now more verbose and prints also the yafu output. found factors are marked - now a random number of the first 1000 composites >= 70 digits is fetched. This allows running it in parallel without fetching the same composite - some error handling [CODE]#!/bin/perl use warnings; use strict; use LWP::Simple; while(1){ print "get composites\n"; my $rand=int(rand(1000)); my $contents = get("http://factorization.ath.cx/listtype.php?t=3&mindig=70&perpage=1&start=$rand&download=1"); if (!defined $contents or $contents =~ /[a-z]/ ){ print "$contents\n"; print "Error, no composites fetched\n"; sleep(60); } my @composites=split(/\s/, $contents); foreach my $composite (@composites) { print "Factoring ".length($composite)." digits: $composite\n"; my @results; open(YAFU, "yafu factor($composite) |") or die "Couldn't start yafu!"; while (<YAFU>) { chomp; print "$_\n"; if (/^[CP].*? = (\d+)/) { push( @results, $1 ); print "*****\n"; } } close(YAFU); if ( scalar(@results) > 0 ) { print "===========================================================================\n"; print "report factors\n"; my $url="http://factorization.ath.cx/report.php?report=".$composite."%3D2".join('*',@results); #print "$url\n"; $contents=get($url); if ($contents=~/Factor already known/){ print "===> Faktor already known\n"; }else{ print "===> new Faktors\n"; } print "===========================================================================\n"; }else { print "Error, no result found\n"; sleep(60); } } } die; [/CODE] yoyo |
Nice script Yoyo!:smile:
I`m using this script now on my Laptop. |
[QUOTE=yoyo;269936]
- some error handling [/QUOTE] In spite of our last discussions, I put my nose a little bit into perl. Having about 30 years of programming on my shoulders, I can easily understand and learn any new language, but of course I am far away to be an expert in perl. For that, another 20 years would be necessary :D BUT, as a general rule of programming, you should always parse the case you are interested in, and let the other cases on the "else" basket. [CODE] get composites Factoring 81 digits: 7068..... factoring 7068..... using pretesting plan: normal div: primes less than 10... ... etc Total factoring time = 0.1094 seconds ***factors found*** PRP5 = 61703 ***** PRP7 = 2998... ***** ..... PRP9 = 9349..... ***** PRP19 = 9349..... ***** ans = 1 ====================================== report factors ===> new Factors ====================================== [/CODE]See what I mean? I don't believe that such small factors were unknown to the server. Only the last one is a PRP19, rest of them below 9 digits. The point is that in such case the server most probably replies "small factors". And in this case, the string "factor already known" that you are parsing for, can not be found. You have to parse for the "factor added", or so, and in that case, return "new factors". The "else" can be a full set of other situations that you are not interested in. Like "factor already known, or too small factors, or some rubbish text coming back from the server, bad connection, could not report, etc, etc, etc". Of course you don't need to display all these things, "no new factors" would be enough. I had a colleague who was always joking about the programming style like: "This hdd will be formated. Do you want to stop? [y/n]" then "if key pressed is not 'y' then format harddisk". (keep in mind the user can press enter, or uppercase "Y", beside of the fact the question is crossed the unaware user could read fast and press 'n' as "no, don't format it"). The cases you are interested in, and the dangerous cases must always be parsed. The rest is "else basket". The rest is ok, this script is dynamite! I will use it from now on. kotgw! (edit: yes, is factor, not faktor, I modified directly in the script, the snippet above come from mark/copy/paste in the cmd prompt window. I put this "edit" only to avoid any arguing that the output does not come from the script) |
[QUOTE=cmd;270058]/\/\ | () | \/\/ ,,, |-||=|_|°[/QUOTE]
?? [ = HELP] [quote=factordb][B]Local, non distributed workers[/B] [B][COLOR="Red"]Optimizing tables - workers are offline for ~ 10 hours.[/COLOR][/B] [B]0 workers connected[/B] [/quote] Sorry, Syd, I was pulling a fresh status for the aliquot project, but I'll put that off until tomorrow.... |
[QUOTE=LaurV;270059]In spite of our last discussions, I put my nose a little bit into perl. Having about 30 years of programming on my shoulders, I can easily understand and learn any new language, but of course I am far away to be an expert in perl. For that, another 20 years would be necessary :D
BUT, as a general rule of programming, you should always parse the case you are interested in, and let the other cases on the "else" basket. [CODE] get composites Factoring 81 digits: 7068..... factoring 7068..... using pretesting plan: normal div: primes less than 10... ... etc Total factoring time = 0.1094 seconds ***factors found*** PRP5 = 61703 ***** PRP7 = 2998... ***** ..... PRP9 = 9349..... ***** PRP19 = 9349..... ***** ans = 1 ====================================== report factors ===> new Factors ====================================== [/CODE]See what I mean? I don't believe that such small factors were unknown to the server. Only the last one is a PRP19, rest of them below 9 digits. The point is that in such case the server most probably replies "small factors". And in this case, the string "factor already known" that you are parsing for, can not be found. You have to parse for the "factor added", or so, and in that case, return "new factors". The "else" can be a full set of other situations that you are not interested in. Like "factor already known, or too small factors, or some rubbish text coming back from the server, bad connection, could not report, etc, etc, etc". Of course you don't need to display all these things, "no new factors" would be enough. I had a colleague who was always joking about the programming style like: "This hdd will be formated. Do you want to stop? [y/n]" then "if key pressed is not 'y' then format harddisk". (keep in mind the user can press enter, or uppercase "Y", beside of the fact the question is crossed the unaware user could read fast and press 'n' as "no, don't format it"). The cases you are interested in, and the dangerous cases must always be parsed. The rest is "else basket". The rest is ok, this script is dynamite! I will use it from now on. kotgw! (edit: yes, is factor, not faktor, I modified directly in the script, the snippet above come from mark/copy/paste in the cmd prompt window. I put this "edit" only to avoid any arguing that the output does not come from the script)[/QUOTE] The script does not really parse the result of adding factors. I didn't found a way to find out if the factors to this composite were added or if the composite was already factored. The webpage didn't say it, as far as I remember. yoyo |
1 Attachment(s)
[QUOTE=yoyo;270067]The script does not really parse the result of adding factors. I didn't found a way to find out if the factors to this composite were added or if the composite was already factored. The webpage didn't say it, as far as I remember.
yoyo[/QUOTE] Ok. I took the liberty to play a bit with your script. First of all, I took the first link from inside and changed the variables to a couple of fixed numbers. Put it in my browser. The server always return a single line, with the number to factor. Everything is clear here. Second, I took the reporting link and changed to fixed numbers. Put it into my browser. "http://factorization.ath.cx/report.php?report=2047%3D89%3D23" It says 23 and 89 are "small numbers". Changed 23 to 22. It says 22 is also "small number" that divides 2047. It seems that the server does not really check if they are factors, when they are small. For example the line "http://factorization.ath.cx/report.php?report=2047%3D87%3D29%3D467" will always produce the result as in the attached file. The server DOES check the factors if they are bigger. If I used a C50 with fake factors, I get in the right column "Does not divide" instead of "Small factor". When I reported real factors, but known by the server, I get (as normal) "Factor already known". I factored a couple of C30 to C50 numbers, by changing the "rand(1000)" part into the script into "rand(45)+10", to get factors around the 50th position in the list. Today there was plenty of such factors, because the computers were stopped on the DB side. The factoring went fast and I logged all the communication with the server. When I reported (real, unknown) factors, I always get both messages in the right column, like "Factor added" for the first factor, and "Factor already known" for the others (the server is checking the cofactors by itself). Sometimes I also get strange things coming back from the server. But it seems like a new factor was found only when the string that come back from the server contains "factor added" phrase. The right way would be to change the last "if" of the script into something like [CODE] if ($contents [put here whatever means in perl that "contains" or make a function to parse the return string] /Factor added/ print "===> New Factor(s) Reported\n"; }else{ print "===> Factor already known or other error\n"; } [/CODE]Maybe someone on the DB side can enlighten us or give us an easier way to report factors (a link where the response is just one precise line, same way as when the number to factor is requested) ?? [edit]And by the way, I forgot the most important thing: your script contains an [B]error in the reporting link[/B], there is an additional "2" after the "%3D" (most probably a typo). This makes all the time that the first factor is reported wrong, so you always get a "does not divide" for the first factor, because a "2" is added in front of it. For example a factor like "87674643" (made up now) will be reported as "287674643". I saw this in the communication log that I just told you about. You can easily check this if you add a "print $contents" line before the last "print =====..." line. You will see on the screen the reply from the server. The first factor always get an "Does not devide" tag on the table. Only the subsequent factors are reported right. The server is parsing all the non-digit characters that are between slashes or "=" signs (%3D character). So, if you put in your browser a line like (numbers just made up) [url]http://factorization.ath.cx/report.php?report=123452047=1YES87=4PRH67[/url] you will get the table saying 123452047 has factors 187 and 467. Non-digits are ignored. |
1 Attachment(s)
hmmm can't attach 2 files. This I mean.
|
I improved the result handling a bit and removed the "2" in the reporting URL, which was a typo.
[CODE]#!/bin/perl use warnings; use strict; use LWP::Simple; while(1){ print "get composites\n"; my $rand=int(rand(1000)); my $contents = get("http://factorization.ath.cx/listtype.php?t=3&mindig=70&perpage=1&start=$rand&download=1"); if (!defined $contents or $contents =~ /[a-z]/ ){ print "$contents\n"; print "Error, no composites fetched\n"; sleep(60); } my @composites=split(/\s/, $contents); foreach my $composite (@composites) { print "Factoring ".length($composite)." digits: $composite\n"; my @results; open(YAFU, "yafu factor($composite) |") or die "Couldn't start yafu!"; while (<YAFU>) { chomp; print "$_\n"; if (/^[CP].*? = (\d+)/) { push( @results, $1 ); print "*****\n"; } } close(YAFU); if ( scalar(@results) > 0 ) { print "===========================================================================\n"; print "report factors\n"; my $url="http://factorization.ath.cx/report.php?report=".$composite."%3D".join('*',@results); #print "$url\n"; $contents=get($url); #print "$contents\n"; if ($contents=~/(Found \d+ factors)/){ print "===> $1\n"}; my $already_known = ($contents =~ s/Factor already known//g); my $added = ($contents =~ s/Factor added//g); my $small = ($contents =~ s/Small factor//g); if ($added>0) {print "$added factors added\n";} if ($already_known>0) {print "$already_known factors already known\n";} if ($small>0) {print "$small small factors\n";} print "===========================================================================\n"; }else { print "Error, no result found\n"; sleep(60); } } } die; [/CODE] yoyo |
1 Attachment(s)
@yoyo
That's much better now. I will continue to play with it, and report all the factors found on the way. Thanks @cmd yeah, I exaggerated a bit with the numbers of the extra characters, but that was not the point, and there was no reason for you to try to follow the link (in fact I didn't put a link, the forum automatically changed my text to link). I realized immediately and re-edited the post. You just felt "in between". The idea is the fact that the server is parsing everything what is not numeric, and the fragment of my post was strictly addressed to yoyo, who understood the problem correctly. As a proof, is his new script. Now, just for your inner peace, follow the link in that post again. I will copy it again here in code tags to be full visible (uncut in the middle). [CODE]http://factorization.ath.cx/report.php?report=123452047=1YES87=4PRH67 [/CODE]You will get something as in the attached file, and if not, then something is wrong in your connection, or the server's geeks fixed the problem (nothing to fix, however, when you report factors you must use a right link, this is just for sake of the discussion). Case closed from my point of view. |
Syd,
I'd like to help the factordb get better at recognizing algebraic factors of cyclotomic numbers - currently it misses many of these. I have competence is SQL, C, and other programming languages. Would you welcome collaboration on a programming level, or would you prefer that I explain the improvements I envision, or would you prefer I just go away because you are too busy? William |
| All times are UTC. The time now is 23:00. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.