![]() |
|
|
#45 | |
|
"Ed Hall"
Dec 2009
Adirondack Mtns
11·347 Posts |
Quote:
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? |
|
|
|
|
|
|
#46 | |
|
"Ed Hall"
Dec 2009
Adirondack Mtns
11×347 Posts |
Quote:
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
Code:
WARNING: @index ####: partial last line. |
|
|
|
|
|
|
#47 |
|
"Alexander"
Nov 2008
The Alamo City
24·43 Posts |
Aliquot sequence 1750944 has an error at index 1068.
|
|
|
|
![]() |
| 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 |