mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > FactorDB

Reply
 
Thread Tools
Old 2020-05-16, 11:47   #45
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

5×631 Posts
Default

Quote:
Originally Posted by LaurV View Post
Nice job. Used to do all this procedure with the editor, in both pn2 and notepad++ you can mark/delete rectangular blocks (using shift+alt) and auto-number text lines. It is only a couple of cut/paste and takes a minute.
I'm not familiar with pn2, but Notepad++ needs Windows. (Wine has just notepad.) That would be a bigger effort for me. I wonder if gedit has this capability.

I'm thinking of expanding the script to do everything from just entering the broken sequence. Maybe I'll do that later, just for fun. Isn't really that big a call for it, is there? Are there more than three broken sequences?
EdH is offline   Reply With Quote
Old 2020-05-16, 15:22   #46
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

5×631 Posts
Default

Quote:
Originally Posted by EdH View Post
I'm thinking of expanding the script to do everything from just entering the broken sequence. Maybe I'll do that later, just for fun. Isn't really that big a call for it, is there? Are there more than three broken sequences?
Here's a larger script that will take a sequence number and generate a local "fixed" .elf file for it. This works for me, but I can't guarantee success elsewhere:
Code:
#!/bin/bash
# Script to locally fix a broken Aliquot sequence
# Access to factordb.com is necessary
# aliqueit is necessary
# No error checking is performed
# Use at own risk

# Acquire sequence number, if not provided on command line
if [ ${#1} -lt 3 ]
  then printf "Aliquot sequence: "
  read sequence in
else
  sequence=$1
fi

# Retrieve sequence.elf 
echo "Retrieving $sequence.elf. . ."
wget -q -U Mozilla/5.0 "http://factordb.com/elf.php?seq=$sequence&type=1" -O alq_$sequence.elf 

# Test sequence with aliqueit
./aliqueit $sequence -t >temp

# Acquire index of first invalid line
exec <"temp"
  while read line
    do
      case $line in
        "ERROR"*) index=${line:14};;
      esac
    done
colon=$(echo `expr index "$index" :`)
index=${index:0:colon-1}

# Truncate sequence.elf into temporary file
count=0
rm ${sequence}T 2>/dev/null
exec <"alq_${sequence}.elf"
  while read line
    do
      if [ $count -lt $index ]
        then echo "$line" >> ${sequence}T
      fi
      let count=${count}+1
    done
rm alq_$sequence.elf
cp ${sequence}T alq_$sequence.elf

# Run aliqueit to create next index
./aliqueit $sequence -q >/dev/null

# Find new sequence from new index
newseq=$(tail -1 alq_$sequence.elf)
period=$(echo `expr index "$newseq" .`)
equals=$(echo `expr index "$newseq" =`)
newseq=${newseq:${period}+2:${equals}-${period}-4}
echo "$newseq"

# Retrieve new sequence.elf 
echo "Retrieving $newseq.elf."
wget -q -U Mozilla/5.0 "http://factordb.com/elf.php?seq=$newseq&type=1" -O alq_$newseq.elf 

# Splice the two sequences and renumber sequence.elf
rm temp.elf 2>/dev/null
count=0
exec <"${sequence}T"
  while read line
    do
      period=$(echo `expr index "$line" .`)
      echo "${count} ${line:$period-1}" >>temp.elf
      let count=${count}+1
    done
exec <"alq_$newseq.elf"
  while read line
    do
      period=$(echo `expr index "$line" .`)
      echo "${count} ${line:$period-1}" >>temp.elf
      let count=${count}+1
    done
rm alq_$sequence.elf
mv temp.elf alq_$sequence.elf

# Verify sequence .elf
./aliqueit $sequence -t
All valid factordb .elf files generate a warning in Aliqueit:
Code:
WARNING: @index ####: partial last line.
This signals success.
EdH is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Graphs broken for aliquot sequences on factordb fivemack Aliquot Sequences 4 2018-03-23 11:54
Broken sequences / duplicate entries Syd FactorDB 33 2014-03-20 12:33
Broken aliquot sequences schickel FactorDB 18 2013-06-12 16:09
A new theorem about aliquot sequences garambois Aliquot Sequences 34 2012-06-10 21:53
New article on aliquot sequences schickel mersennewiki 0 2008-12-30 07:07

All times are UTC. The time now is 16:57.

Sun May 31 16:57:08 UTC 2020 up 67 days, 14:30, 1 user, load averages: 2.29, 2.16, 2.03

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, 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.