![]() |
[QUOTE=maxal;230639]Thanks, that's helpful
But n=100 seems to produce only a couple of dozens id's ;( Also, parameter maxdig would be helpful to avoid factorization of monsters. On a different topic, could you please add support for cyclotomic polynomials (similarly to Phi() in ecm) ?[/QUOTE] Sure you can. Maxdig is in and the n=100 limit now also works. For retrieving the numbers there is another script thats maybe helpful: getnumber.php?id=<id> returns the Code (C, PRP, ..)+space+all digits. No HTML at all. I'll add the cyclotomic polynomials later - first I have to read about that topic. |
[QUOTE=Syd;230641]I'll add the cyclotomic polynomials later - first I have to read about that topic.[/QUOTE]
Factorizations available [url=http://www.asahi-net.or.jp/~kc2h-msm/cn/]here[/url] |
[QUOTE=Syd;230641]Sure you can. Maxdig is in and the n=100 limit now also works.[/QUOTE]
[url]http://factordb.com/getrandom.php?n=100&t=3[/url] produces an empty page ;( |
[QUOTE=maxal;230647][url]http://factordb.com/getrandom.php?n=100&t=3[/url] produces an empty page ;([/QUOTE]
Whoops. Wrong maxdig default. Please try again :smile: |
[QUOTE=Syd;230649]Whoops.
Wrong maxdig default. Please try again :smile:[/QUOTE] It now works. Thanks! Here is an updated script that uses new features. [code]#!/usr/bin/perl use strict; print("FactorDB Helper 1.3\n"); # wget executable my $wget = "wget --no-check-certificate"; # msieve executable my $msieve = "/home/maxal/libs/msieve/msieve/trunk/msieve -t 3"; # min and max number of digits to factor my $mindig = 65; my $maxdig = 100; $| = 1; $/ = undef; while(1) { my @todo; # getting 100 random unfactored numbers $_ = `$wget -O - "http://factordb.com/getrandom.php?n=100&t=3&mindig=$mindig&maxdig=$maxdig"`; # or getting 100 smallest unfactored numbers #$_ = `$wget -O - "http://factordb.com/listtype.php?t=3&scriptmode=1"`; while( /(\d{19})\s(\d+)/gs ) { # /<a href=\"index\.php\?id=([^\"]*)\"><font color=\"\#002099\">([^<]*)<\/font><\/a><sub><(\d+)><\/sub>/gs ) { my $id = $1; my $digits = $2; if( ($digits >= $mindig) && ($digits <= $maxdig) ) { push(@todo,$id); } } print("Todo size: ",scalar(@todo),"\n"); if( scalar(@todo) == 0 ) { print("No suitable numbers. Resting for a while.\n"); sleep 60; next; } shuffle(@todo); foreach (@todo) { my $id = $_; # checking status and getting the number in decimal $_ = `$wget -O - http://factordb.com/getnumber.php?id=$id`; if( ! /(\S+)\s(\d+)/ ) { print("Error 1\n"); sleep 60; next; } if( $1 eq "FF" ) { print("\nid=$id is already factored.\n\n"); next; } my $number = $2; my $digits = length($number); print("Factoring $digits-digit number (id=$id)\n"); if( $digits >= 80 ) { $_ = `$msieve -v -n $number`; } else { $_ = `$msieve -v $number`; } if( /prp\d+ factor: (\d+)\s/s ) { my $factor = $1; print("\nFactor found: $factor\n\n"); $_ = `$wget --post-data "report=$factor&format=0" -O - http://factordb.com/index.php?id=$id`; } else { print("Error 2\n"); sleep 60; } } } exit; sub shuffle { for (my $i = 0; $i < @_; $i++) { my $j = rand(@_ - $i) + $i; # pick random element ($_[$i], $_[$j]) = ($_[$j], $_[$i]); # swap 'em } } [/code] |
edit
ok, my fault found the problem : I didn't copy the subroutine at the end, and thanks for the msieve output. Oon another note, don't worry (for now) about the max size. From what i seen , (listtype.php?t=3&start=10000&perpage=1000 - if I use start=11000 its the same page that appear, and it has 77 digits-) the number of digits take a long time rizing. at the speed of 140 sec by number on my medium comp, it will take 427 hours to do them all on a single cpu. -damn it. much shorter than i though- ermmm... but since new composite with no know factor are 'discovered' vey often, it may take much longuer to go to 77 digits |
Helper script + yafu
Hi. I did some refactorization to helper script. This version uses Yafu instead of Msieve.
Changes: shuffle-subroutine from end to begin. Spaces converted to tabs. Yafu insted of Msieve. [code] #!/usr/bin/perl use strict; print("FactorDB Helper 1.4 with yafu\n"); # wget executable my $wget = "wget --no-check-certificate"; # min and max number of digits to factor my $mindig = 71; my $maxdig = 95; $| = 1; $/ = undef; sub shuffle { for ( my $i = 0 ; $i < @_ ; $i++ ) { my $j = rand( @_ - $i ) + $i; # pick random element ( $_[$i], $_[$j] ) = ( $_[$j], $_[$i] ); # swap 'em } } while (1) { my @todo; # getting 100 random unfactored numbers $_ = `$wget -O - "http://factordb.com/getrandom.php?n=100&t=3&mindig=$mindig&maxdig=$maxdig"`; # or getting 100 smallest unfactored numbers #$_ = `$wget -O - "http://factordb.com/listtype.php?t=3&scriptmode=1"`; while (/(\d{19})\s(\d+)/gs) { my $id = $1; my $digits = $2; if ( ( $digits >= $mindig ) && ( $digits <= $maxdig ) ) { push( @todo, $id ); } } print( "Todo size: ", scalar(@todo), "\n" ); if ( scalar(@todo) == 0 ) { print("No suitable numbers. Resting for a while.\n"); sleep 60; next; } shuffle(@todo); foreach (@todo) { my $id = $_; # checking status and getting the number in decimal $_ = `$wget -O - http://factordb.com/getnumber.php?id=$id`; if ( !/(\S+)\s(\d+)/ ) { print("Error 1\n"); sleep 60; next; } if ( $1 eq "FF" ) { print("\nid=$id is already factored.\n\n"); next; } my $number = $2; my $digits = length($number); print("Factoring $digits-digit number (id=$id)\n"); my $yafu = "./yafu \"siqs($number)\" >joo.log"; system($yafu); my $text = do { local ( @ARGV, $/ ) = "joo.log"; <> }; print "Num: $number\nResults:\n"; my @results; my @out = split( "\n", $text ); for (@out) { if (/P.*? = (\d+)/) { push( @results, $1 ); print "$1\n"; } } unlink "joo.log"; if ( scalar(@results) > 0 ) { my $factors = join("\n",@results); $_ = `$wget --post-data "report=$factors&format=0" -O - http://factordb.com/index.php?id=$id`; } else { print("Error 2\n"); sleep 60; } } } [/code] |
The helper script works great!
Just 2 small changes: There has almost no ECM work been done on these numbers, I just pulled a P16 out of a C75 with SIQS. So I changed siqs() to factor() to do proper ECM. The number does not need to be "FF" if a factor is found, it could be "CF" with a small composite part. So changed the check to != "C". [CODE] #!/usr/bin/perl use strict; print("FactorDB Helper 1.4 with yafu\n"); # wget executable my $wget = "wget --no-check-certificate"; # min and max number of digits to factor my $mindig = 65; my $maxdig = 95; $| = 1; $/ = undef; sub shuffle { for ( my $i = 0 ; $i < @_ ; $i++ ) { my $j = rand( @_ - $i ) + $i; # pick random element ( $_[$i], $_[$j] ) = ( $_[$j], $_[$i] ); # swap 'em } } while (1) { my @todo; # getting 100 random unfactored numbers $_ = `$wget -O - "http://factordb.com/getrandom.php?n=100&t=3&mindig=$mindig&maxdig=$maxdig"`; # or getting 100 smallest unfactored numbers #$_ = `$wget -O - "http://factordb.com/listtype.php?t=3&scriptmode=1"`; while (/(\d{19})\s(\d+)/gs) { my $id = $1; my $digits = $2; if ( ( $digits >= $mindig ) && ( $digits <= $maxdig ) ) { push( @todo, $id ); } } print( "Todo size: ", scalar(@todo), "\n" ); if ( scalar(@todo) == 0 ) { print("No suitable numbers. Resting for a while.\n"); sleep 60; next; } shuffle(@todo); foreach (@todo) { my $id = $_; # checking status and getting the number in decimal $_ = `$wget -O - http://factordb.com/getnumber.php?id=$id`; if ( !/(\S+)\s(\d+)/ ) { print("Error 1\n"); sleep 60; next; } if ( $1 != "C" ) { print("\nid=$id has known factors / is already factored.\n\n"); next; } my $number = $2; my $digits = length($number); print("Factoring $digits-digit number (id=$id)\n"); my $yafu = "H:/PATH/TO/YAFU/yafu \"factor($number)\" >joo.log"; system($yafu); my $text = do { local ( @ARGV, $/ ) = "joo.log"; <> }; print "Num: $number\nResults:\n"; my @results; my @out = split( "\n", $text ); for (@out) { if (/P.*? = (\d+)/) { push( @results, $1 ); print "$1\n"; } } unlink "joo.log"; if ( scalar(@results) > 0 ) { my $factors = join("\n",@results); $_ = `$wget --post-data "report=$factors&format=0" -O - http://factordb.com/index.php?id=$id`; } else { print("Error 2\n"); sleep 60; } } }[/CODE] |
for Syd version to work(for windows) you need to change
[code] my $yafu = "./yafu \"factor($number)\" >joo.log" to my $yafu = "H:/Docume~1/Vincent/Bureau/script/yafu \"factor($number)\" >joo.log"; [/code]and since the 64- digits are automatically factored, why do 'we' set the min digit limit at 71 digits? this is a 7 digits disperency |
[QUOTE=firejuggler;230675][code]
my $yafu = "H:/Docume~1/Vincent/Bureau/script/yafu \"factor($number)\" >joo.log"; [/code][/QUOTE] This depends on your computer. Set $yafu without any path and put the pl-script and yafu.exe/ini in the same folder. |
i'm using a shortcut to run the script.that need the full path
|
| All times are UTC. The time now is 23:09. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.