[seqfan] Re: OEIS wiki user update
Joerg Arndt
arndt at jjj.de
Mon Dec 14 08:28:00 CET 2009
* rhhardin at att.net <rhhardin at att.net> [Dec 14. 2009 09:02]:
> > I assume you retrieve the raw database files(?)
>
> No, I imitate URL that the search string that the GUI would construct and use it in wget;
> then run the resulting retrieved page through a script to extract what I need.
>
> Thus off my screen right now
> $ eisfinder.sh
> stat101.txt 6 24 120 720 exists A000142 A047865 A052399 A061602 A068201 A122417 A130461 A131451...
> stat102.txt 6 90 2520 113400 exists A000680
> stat202.txt 3 21 282 6210 202410 exists A000681
> stat203.txt 7 16260 747558000 exists A134645
> stat204.txt nothing for 19 2385 1093050 1328792850
> stat303.txt 4 55 2008 153040 20933840 exists A001500
> stat306.txt nothing for 44 28681 122975608 2217051589200
> stat404.txt nothing for 3 87 8515 1992760 971853075
> stat406.txt nothing for 7 4705381 654393258290520
> stat408.txt nothing for 19 81225 3017084995
> stat505.txt nothing for 87 20112 13130451
> stat510.txt nothing for 6 81225 19641294288 37642786694586601
> stat606.txt nothing for 55 27636 45934340 210668680701
> stat612.txt nothing for 28681 38578100932 552523141020099900
> stat808.txt nothing for 6 8515 2805859246095
> stat918.txt nothing for 122975608 552523141020099900
>
> says that five of the series currently being constructed already exist in OEIS.
> --
> rhhardin at mindspring.com
> rhhardin at att.net (either)
>
This appears valid use to me. I do the same with a local copy of the
database to reduce server load (and get results faster). Obviously
this approach has no superseeker capabilities.
Attached the (somewhat nasty) script for local searches.
-------------- next part --------------
#! /bin/zsh
# Search integer sequences in local copy of the
# Online Encyclopedia of Integer Sequences (OEIS).
# http://www.research.att.com/~njas/sequences/
#
# Normalizes argument for search, e.g.:
# arg search_for
# 1 2 3 4 5 ,1,2,3,4,5,
# 1 2 3 +4 5 ,1,2,3,4,5,
# 1 2-3+4, 5 ,1,2,-3,4,5,
# 1 2 3 -4 5 ,1,2,3,-4,5,
# 1, 2 , 3 4 5 ,1,2,3,4,5,
# 1,\, 2 ,\, 3,\, 4,\, 5 ,1,2,3,4,5,
# 1..1...1..1..1. ,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,
# _100100010010010 ,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,
# _1234567 ,1,2,3,4,5,6,7,
# p 1 -2 -3 4 5 -6 -7 ,1,2,3,4,5,6,7,
#
# ... online at http://www.jjj.de/
# author: Joerg Arndt ( arndt (AT) jjj.de )
# version: 2007-June-11
## CHANGE to your needs:
OEISFILE=~/other/oeis-data/stripped
OEISFILEPOS=~/other/oeis-data/stripped-pos
OEISNAMES=~/other/oeis-data/names
test -f $OEISFILE || exit 1
#set -vx
#DEBUG=1
#unset DEBUG
[[ -n "$DEBUG" ]] && echo "DEBUG" 1>&2;
function normK
{
[[ -n "$DEBUG" ]] && echo "normK():" 1>&2;
SEQ="$1";
[[ -n "$DEBUG" ]] && echo "[$SEQ]" 1>&2;
SEQ=${SEQ// /,};
[[ -n "$DEBUG" ]] && echo "[$SEQ]" 1>&2;
TSEQ=""
until [[ "$SEQ" == "$TSEQ" ]]; do # remove multiple ','
TSEQ=$SEQ;
SEQ=${TSEQ//,,/,};
[[ -n "$DEBUG" ]] && echo "[$SEQ]" 1>&2;
done
SEQ=${SEQ#,}
[[ -n "$DEBUG" ]] && echo "[$SEQ]" 1>&2;
SEQ=${SEQ%,}
[[ -n "$DEBUG" ]] && echo "[$SEQ]" 1>&2;
echo $SEQ;
} ###
function normD
{
[[ -n "$DEBUG" ]] && echo "normD():" 1>&2;
SEQ="$1";
SEQ=${SEQ//,/};
SEQ=${SEQ//_/};
SEQ=${SEQ//\./0};
[[ -n "$DEBUG" ]] && echo "$k [$SEQ]" 1>&2;
ns=${#SEQ};
[[ -n "$DEBUG" ]] && echo "[$ns]" 1>&2;
T=""
for (( k=1; k<=ns; ++k ))
{
T="$T,$SEQ[k]";
[[ -n "$DEBUG" ]] && echo "$k [$SEQ]" 1>&2;
}
SEQ=$T;
SEQ=${SEQ%,}
[[ -n "$DEBUG" ]] && echo "[$SEQ]" 1>&2;
SEQ=${SEQ#,}
[[ -n "$DEBUG" ]] && echo "[$SEQ]" 1>&2;
echo $SEQ;
} ###
SEQ=$@
T="${SEQ//\./0}"
[[ "$T" != "$SEQ" ]] && SEQ="_$SEQ";
SEQ="${SEQ//\[/}"
SEQ="${SEQ//\]/}"
SEQ="${SEQ//+/ }"
SEQ="${SEQ//-/ -}"
T="$SEQ"
#[[ $T[1] = p ]] && { SEQ="${SEQ//-/ }"; SEQ="$SEQ[2,-1]"; }
[[ $T[1] = p ]] && { SEQ="${SEQ//-/ }"; SEQ="$SEQ[2,-1]"; OEISFILE=$OEISFILEPOS; }
SEQ=$(normK "$SEQ")
[[ "${SEQ}" != "${SEQ//_/X}" ]] && SEQ=$(normD "$SEQ")
[[ -n "$DEBUG" ]] && echo "[$SEQ]" 1>&2;
[[ $SEQ[1] == "A" ]] || SEQ=",$SEQ,";
echo "searching for [$SEQ]" 1>&2;
grep -F "$SEQ" $OEISFILE
[[ $SEQ[1] = 'A' ]] && grep -F "$SEQ" $OEISNAMES
#######################################
More information about the SeqFan
mailing list