![]() |
|
|
#1 |
|
"Jason Goatcher"
Mar 2005
3×7×167 Posts |
I have no programming skills and I'm getting frustrated with all the typing/copying/pasting I'm having to do in the octoproth search.
I'll give an Amazon book(paperback) to whoever can accomplish the following(first come first served). I'm guessing it'll be a command-line batch file, I don't know. Basically, it takes the following parameters(an instruction file to go along with the program would be great). The n-value, the range of k in trillion(it would automatically add the 12 zeroes when it made the file), how many k per line, in trillion. then the filename it would go to/be appended to. Alternately, it would be nice if n could be entered as a range, and grouped with commas(300-305,307 would do all n-values from 300 to 307, except 306)Basically it would be something like: Code:
command.bat 300 0 1000 50 >> test.bat [code]octo_6_0 300 0 50000000000000 octo_6_0 300 50000000000000 100000000000000 octo_6_0 300 100000000000000 150000000000000 octo_6_0 300 150000000000000 200000000000000 octo_6_0 300 200000000000000 250000000000000 octo_6_0 300 250000000000000 300000000000000 octo_6_0 300 300000000000000 350000000000000 octo_6_0 300 350000000000000 400000000000000 octo_6_0 300 400000000000000 450000000000000 octo_6_0 300 450000000000000 500000000000000 octo_6_0 300 500000000000000 550000000000000 octo_6_0 300 550000000000000 600000000000000 octo_6_0 300 600000000000000 650000000000000 octo_6_0 300 650000000000000 700000000000000 octo_6_0 300 700000000000000 750000000000000 octo_6_0 300 750000000000000 800000000000000 octo_6_0 300 800000000000000 850000000000000 octo_6_0 300 850000000000000 900000000000000 octo_6_0 300 900000000000000 950000000000000 octo_6_0 300 950000000000000 1000000000000000[code] I do intend to take a C programming course during the summer, but I have no skills at the moment. |
|
|
|
|
|
#2 |
|
Jun 2005
USA, IL
193 Posts |
For quick and dirty programs, I use Icon since it doesn't take to much to test, and because they have a free compiler. Attached is a zip file containing the source below, and the command line program compiled for use in Windows.
I didn't include an option to range the n_value, but I'm lazy like that sometimes. :) Code:
procedure main(args)
if ( (args[1] == "\\?") | (args[1] == "/?") | (args[1] == "help") ) then {
write("jasong_cmd n_value k_begin k_end k_per_line output_file")
write("")
write("n_value Specifies the value of n")
write("k_begin Specifies the beginning range of k in trillions")
write("k_end Specifies the ending range of k in trillions")
write("k_per_line Specifies the increment of k in trillions")
write("output_file Specifies the output file to create")
write("")
write("")
write("Example: jasong_cmd 300 0 1000 50 test.bat")
write("")
}
else{
#assign arguments to recognizable variable names
n_value := args[1]
k_begin := args[2]
k_end := args[3]
k_per_line := args[4]
output_file := args[5]
#open output file
if not (output_file === &null) then { output := open(output_file, "a") }
#if not starting at zero, start first value in trillions
k_current := k_begin
writes(output,"octo_6_0 ",n_value," ",k_begin)
if not ( k_begin < 1 ) then { writes(output,"000000000000") }
write(output," ",k_begin + k_per_line,"000000000000")
k_current := k_current + k_per_line
#write remaining values
while ( k_current < k_end ) do {
write(output,"octo_6_0 ",n_value," ",k_current,"000000000000 ",k_current + k_per_line,"000000000000")
k_current := k_current + k_per_line
}
#close output file
if not (output_file === &null) then { close(output) }
}
end
|
|
|
|
|
|
#3 | |
|
"Jason Goatcher"
Mar 2005
350710 Posts |
Quote:
|
|
|
|
|
|
|
#4 |
|
Jun 2005
USA, IL
110000012 Posts |
Maybe put it towards the Gimps Prize?
|
|
|
|
|
|
#5 |
|
Feb 2006
3·17 Posts |
Hi Jasong
This python (www.python.org) program should do the trick. Code:
import sys
import os
if len(sys.argv) != 7:
print "The program takes 6 argv; start number of n, stop number of n, start value of k, stop value of k, incriments, fil name. If file exist data is appended otherwise the file is created."
sys.exit()
if os.path.exists(sys.path[0] + "\\" + sys.argv[6]):
output = file(sys.path[0] + "\\" + sys.argv[6], "a")
else:
output = file(sys.path[0] + "\\" + sys.argv[6], "w")
for h in range(int(sys.argv[1]), int(sys.argv[2])+1):
for i in range(int(sys.argv[3]), int(sys.argv[4]), int(sys.argv[5])):
output.write("octo_6_0 %d %d %d \n" % (h, i*int(1E12), i*int(1E12)+int(sys.argv[5])*int(1E12)))
output.close()
It is commandline driven: jasong.py 300 300 0 1000 50 test.txt It is quite hard to do the grouping trick, so the program takes a start value for n and an end value for n. Incriment for n is 1. If the file exist data is appended, otherwise a new file is created. So your 300-305,307 values for n goes like this: jasong.py 300 305 0 1000 50 test.txt jasong.py 307 307 0 1000 50 test.txt If (k high - k low)/incriment is not a hole number the last number in the last line will exide k high. I can“t test the code in unix envirement, there might be some problems with the generation of the file neme due to changes in \ and /. Let me know if you get any problems. -Eivind Ps. No book is needed - save it for better hardware
|
|
|
|
|
|
#6 |
|
Sep 2002
Database er0rr
22·941 Posts |
Code:
if os.path.exists(sys.path[0] + "\\" + sys.argv[6]):
output = file(sys.path[0] + "\\" + sys.argv[6], "a")
else:
output = file(sys.path[0] + "\\" + sys.argv[6], "w")
Code:
output = file(sys.argv[6], "a") Last fiddled with by paulunderwood on 2007-03-16 at 19:46 |
|
|
|
|
|
#7 |
|
Feb 2006
3·17 Posts |
Hi Poul
Your right, that code works corretly, so no need to import the os This boils the code down to: Code:
import sys
if len(sys.argv) != 7:
print "The program takes 6 argv; start number of n, stop number of n, start value of k, stop value of k, incriments, fil name. If file exist data is appended otherwise the file is created."
sys.exit()
output = file(sys.argv[6], "a")
for h in range(int(sys.argv[1]), int(sys.argv[2])+1):
for i in range(int(sys.argv[3]), int(sys.argv[4]), int(sys.argv[5])):
output.write("octo_6_0 %d %d %d \n" % (h, i*int(1E12), i*int(1E12)+int(sys.argv[5])*int(1E12)))
output.close()
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Amazon EC2 | patrik | Cloud Computing | 71 | 2016-10-17 09:26 |
| How to send a PM to Batalov | pinhodecarlos | Forum Feedback | 3 | 2016-06-08 02:43 |
| Where do I send my PRP primes with large k? | Trilo | Riesel Prime Search | 3 | 2013-08-20 00:32 |
| Very odd error 7, send benchmark data. | Uncwilly | PrimeNet | 2 | 2008-12-29 04:48 |
| Where to send ECM curves completed? | edorajh | Factoring | 5 | 2005-09-26 08:54 |