View Single Post
Old 2019-11-03, 02:45   #6
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

5·11·61 Posts
Default

I might be totally off the track, but couldn't you find the mergers by checking the last index for each sequence instead of downloading the whole sequence and looking for 80 digit matches?

I have a bash script that does that on a small scale. I don't know if it's of use, but I'll post it here with a description.

Basically, you make a list of all the sequences you would like to check, called seqList in the example below. Then you run the script and it downloads the last line page for each sequence, and looks for the last index on that page. It puts the index number into a matching array to the sequences that were read in. After the last sequence is retrieved from the db, it does a slow crawl through the index list looking for matches. If it finds a match, it lists the two sequences. If you're concerned about the load on the db, you can uncomment the sleep line and set it to 1 or 2 (or more) seconds.

I haven't tried this on a really large list, but here is a sample list with some of your earlier mergers, the script and output:

seqList example:
Code:
276
3366
4788
9852
29412
314718
1316832
2042496
seqTest.sh:
Code:
#!/bin/bash

count1=1
exec <"seqList"
  while read line
    do
      num[count1]=$line
      let count1=${count1}+1
    done

count2=1
while [ $count2 -lt $count1 ]
  do
      wget -q -U Mozilla/5.0 "http://factordb.com/sequences.php?se=1&aq=${num[$count2]}&action=last" -O dbTemp
      exec <"dbTemp"
        while read lastLine
          do
            case $lastLine in
              *"index.php?id="*) ind1=${lastLine##*index.php?id=}
              ind2[count2]=${ind1:0:19}
            esac
          done
    let count2=${count2}+1
#    sleep 1
  done

count3=1
while [ $count3 -lt $count1 ]
  do
    count4=2
      while [ $count4 -lt $count3 ]
        do
          if [ ${ind2[$count4]} -eq ${ind2[$count3]} ]
            then
              echo "Sequence ${num[$count4]} matches sequence ${num[$count3]}"
          fi
          let count4=${count4}+1
        done
    let count3=${count3}+1
  done
Output:
Code:
$ bash seqTest.sh
Sequence 4788 matches sequence 314718
Sequence 29412 matches sequence 1316832
Sequence 9852 matches sequence 2042496
I would think this could be used for a much larger list, but it would have to be let run to finish as it sits. I suppose it could be modified to write the sequence and index in a similar fashion to the earlier list and it could be done in sections then, with the sections concatenated for later review.

All comments are welcome, including those that tell me how full of it I am. . .
EdH is offline   Reply With Quote