mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > YAFU

Reply
 
Thread Tools
Old 2019-04-20, 17:37   #1
mnh001
 
Apr 2011

26 Posts
Default APRCL and flags

Is there a way to have APRCL output to file without all the verbosity?

I'm using yafu-Win32.exe "aprcl(@)" -batchfile in.bat > outfile.txt on the command line and it works fine. But when you have an outfile with thousands of results in it it is impractical to go through it manually trying to pull out the primes.

I know I can use factor with the batchfile and use the -op flag to get no verbosity at all but it takes factor a lot longer. Eg, I have a 1.19Mb in.bat file. Using APRCL took 15 minutes to test all the numbers. Using factor took 47 minutes. And these were small numbers (19 digits long each). They only get bigger from here.

If worse comes to worse I can use Excel or Word and write some VB code to go through the outfile and pull out the primes but I'm trying to avoid that. So how do I get APRCL to output ONLY the prime numbers themselves? TIA
mnh001 is offline   Reply With Quote
Old 2019-04-20, 18:16   #2
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

244128 Posts
Default

Quote:
Originally Posted by mnh001 View Post
I'm using yafu-Win32.exe "aprcl(@)" -batchfile in.bat > outfile.txt on the command line and it works fine. But when you have an outfile with thousands of results in it it is impractical to go through it manually trying to pull out the primes.
grep

Last fiddled with by xilman on 2019-04-20 at 18:17
xilman is offline   Reply With Quote
Old 2019-04-20, 18:40   #3
mnh001
 
Apr 2011

1008 Posts
Default

Umm, what does grep mean?
mnh001 is offline   Reply With Quote
Old 2019-04-20, 19:42   #4
a1call
 
a1call's Avatar
 
"Rashid Naimi"
Oct 2015
Remote to Here/There

7·283 Posts
Default

Regular-Expressions

https://en.m.wikipedia.org/wiki/Regular_expression


https://en.m.wikipedia.org/wiki/Grep

You can also use JavaScript which has powerful pattern-matching capabilities and use your browser as the engine.
Personally, I use a combination of notepad and Microsoft word for tasks like this. It's not worth the time to write the code to perform the pattern matching if you know how to manipulate the find and replace features of Microsoft word which can also do pattern-matching.

Last fiddled with by a1call on 2019-04-20 at 19:48
a1call is offline   Reply With Quote
Old 2019-04-20, 20:41   #5
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

67268 Posts
Default

I don't know how to use grep with Windows, but an example using linux:

in.bat:
Code:
791983480490047827611713671673243269719475033357020491318658587370734859917501757247280274120687620244932823203078126584367941327107909441393420761629669182060309428959781205938878991287988842504651654418555273833187612069989016960300232281081564383945219330853192499288775093985688277416598739633747
Command line:
Code:
$ ./yafu "aprcl(@)" -batchfile ./in.bat | grep "Input is prime"
Result:
Code:
Input is prime.  P300
Simply add a pipe to your out file:
Code:
$ ./yafu "aprcl(@)" -batchfile ./in.bat | grep "Input is prime" | >outfile.txt
to send the results there.
EdH is offline   Reply With Quote
Old 2019-04-20, 21:34   #6
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

100100101110102 Posts
Default

Quote:
Originally Posted by a1call View Post
Yeah. Every time I teach or lead teams, I make sure they get comfortable with RegEx.

My students and employees tend to hate me. I'm OK with that.
chalsall is online now   Reply With Quote
Old 2019-04-21, 00:43   #7
mnh001
 
Apr 2011

26 Posts
Default

Ah, I see. Thanks for the info. I'll see how it works.
mnh001 is offline   Reply With Quote
Old 2019-04-21, 11:38   #8
mnh001
 
Apr 2011

4016 Posts
Default

Well, I tried it but it tells me 'The syntax of the command is incorrect.' I'm using yafu-1.34 in Windows XP. I tried taking the pipes out and thought it worked but looking in outfile all it said was 'no switch detected'.
mnh001 is offline   Reply With Quote
Old 2019-04-21, 15:06   #9
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

3,361 Posts
Default

Quote:
Originally Posted by mnh001 View Post
Well, I tried it but it tells me 'The syntax of the command is incorrect.' I'm using yafu-1.34 in Windows XP. I tried taking the pipes out and thought it worked but looking in outfile all it said was 'no switch detected'.
grep is a linux command; on windows you want findstr.

I think something like this would be equivalent to EdH's command:

.\yafu-Win32.exe "aprcl(@)" -batchfile in.bat | findstr /c:"Input is prime" > outfile.txt

Last fiddled with by bsquared on 2019-04-21 at 15:06
bsquared is offline   Reply With Quote
Old 2019-04-21, 15:43   #10
chris2be8
 
chris2be8's Avatar
 
Sep 2009

36748 Posts
Default

Or just use grep etc to search the output file:
Code:
grep prime outfile.txt
Should list just the lines in outfile.txt containing the string prime. findstr should be able to do it as well but I'm not sure of the syntax because I don't have any Windows systems.

Having run yafu you can quickly try grep with various parms until you have the output you want.

Chris
chris2be8 is offline   Reply With Quote
Old 2019-04-21, 15:45   #11
mnh001
 
Apr 2011

26 Posts
Default

Yes, this does indeed work. Thanks. It prints 'Input is prime. P19' to file. It also prints 'Input is composite. C19' to file. Now to modify it so it prints just the actual number. After all, a file full of hundreds of thousands of lines of 'Input is prime/composite. P/C19' doesn't really do any good. :)
mnh001 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
APRCL implementations comparison ldesnogu Computer Science & Computational Number Theory 11 2015-10-28 12:54
Yafu flags on windows yavanna87 YAFU 4 2011-11-09 06:02
msieve_obj_new and flags davidknippers Msieve 2 2011-10-27 11:44

All times are UTC. The time now is 00:13.

Fri Jan 22 00:13:18 UTC 2021 up 49 days, 20:24, 0 users, load averages: 2.42, 2.73, 3.02

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.