View Single Post
Old 2020-11-18, 14:49   #37
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

70638 Posts
Default

Quote:
Originally Posted by Happy5214 View Post
Do you have a script (Linux) I can borrow? I might put a core or two on this in a day or so. Seems more helpful than the low-end aliquot sequences I'm working on now.
Here's a somewhat simple bash script:
Code:
#!/bin/bash/################################
# Note that this script uses two temporary
# files: dbTemp and dbSuccess. It will alter
# and delete previous files with these names.
# This script is single threaded. If using
# multiple instances, you should keep track
# of the hourly limits for factordb.
############################################
  
digitsize=25
totalrun=5

printf "Factoring $totalrun composites:\n\n"
for ((n=0;n<totalrun;n++))
  do
    startt=SECONDS
    randomnumber=$(echo $((10 + RANDOM % 1000)))
    wget "http://factordb.com/listtype.php?t=3&mindig=${digitsize}&perpage=1&start=$randomnumber&download=1" -q -O dbTemp
    exec <"dbTemp"
      read composite in
    echo "Composite $((${n}+1)) of $totalrun is $composite <${#composite}>"
    temp=$(echo "factor($composite, 10^7)" | gp -f -q)
    temp=$(echo "${temp//\n/}" | xargs)
    temp=$(echo "${temp// 1]/}")
    temp=$(echo "${temp//]/}")
    temp=$(echo "${temp//[/*}")
    temp=$(echo "${temp//' '/}")
    printf "Factors are ${temp:1} <$((${SECONDS}-${startt}))s>\n\n"
    returnfactors=${composite}%3D${temp:1}
    wget "http://factordb.com/report.php?report=$returnfactors" -q -O dbSuccess
  done
echo "Total time for $n composites was $SECONDS seconds."
rm dbTemp
Let me know of any programming flaws or troubles.

Last fiddled with by EdH on 2020-11-21 at 16:12 Reason: Bug erradication!
EdH is offline   Reply With Quote