![]() |
![]() |
#881 | |
Sep 2008
Krefeld, Germany
2·5·23 Posts |
![]() Quote:
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. Last fiddled with by Syd on 2010-09-20 at 21:35 Reason: typo |
|
![]() |
![]() |
![]() |
#883 |
Feb 2005
22×32×7 Posts |
![]()
http://factordb.com/getrandom.php?n=100&t=3 produces an empty page ;(
|
![]() |
![]() |
![]() |
#884 | |
Sep 2008
Krefeld, Germany
111001102 Posts |
![]() Quote:
Wrong maxdig default. Please try again ![]() |
|
![]() |
![]() |
![]() |
#885 |
Feb 2005
22×32×7 Posts |
![]()
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 } } |
![]() |
![]() |
![]() |
#886 |
Apr 2010
Over the rainbow
252910 Posts |
![]()
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 Last fiddled with by firejuggler on 2010-09-20 at 22:45 |
![]() |
![]() |
![]() |
#887 |
Oct 2009
Oulu, Finland
2×3×5 Posts |
![]()
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; } } } |
![]() |
![]() |
![]() |
#888 |
Sep 2008
Krefeld, Germany
E616 Posts |
![]()
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; } } } Last fiddled with by Syd on 2010-09-21 at 00:23 Reason: added firejuggler's comments |
![]() |
![]() |
![]() |
#889 |
Apr 2010
Over the rainbow
32·281 Posts |
![]()
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"; this is a 7 digits disperency Last fiddled with by firejuggler on 2010-09-21 at 00:20 Reason: clarification, spelling error, missing word... |
![]() |
![]() |
![]() |
#890 |
Mar 2006
Germany
132×17 Posts |
![]() |
![]() |
![]() |
![]() |
#891 |
Apr 2010
Over the rainbow
32×281 Posts |
![]()
i'm using a shortcut to run the script.that need the full path
|
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Database for k-b-b's: | 3.14159 | Miscellaneous Math | 325 | 2016-04-09 17:45 |
Factoring database issues | Mini-Geek | Factoring | 5 | 2009-07-01 11:51 |
database.zip | HiddenWarrior | Data | 1 | 2004-03-29 03:53 |
Database layout | Prime95 | PrimeNet | 1 | 2003-01-18 00:49 |
Is there a performance database? | Joe O | Lounge | 35 | 2002-09-06 20:19 |