A command-line Python program that searches offline dumps of the On-Line Encyclopedia of Integer Sequences (OEIS) and prints sequences that match all specified criteria.
Table of contents:
Requires the files names
and stripped
from here. Download names.gz
and stripped.gz
and uncompress them in the same directory as this program. (Use gunzip
on Linux or 7-Zip on Windows to uncompress.)
All arguments are optional.
Tip: to speed up the search, specify at least one of these options.
--minanum INTEGER
: Find sequences whose A-number is greater than or equal toINTEGER
.INTEGER
must be 0 or greater. The default is 0.--maxanum INTEGER
: Find sequences whose A-number is less than or equal toINTEGER
.INTEGER
must be greater than or equal to--minanum
. The default is 999999.--descr TEXT
: Find sequences whose description containsTEXT
case-insensitively.
--searchfirst INTEGER
: When searching, only considerINTEGER
first terms in each sequence. (The rest are ignored.)INTEGER
must be 0 or greater. 0 means all terms are searched. The default is 0. This option affects all other options in this section.--terms LIST
: Find sequences that contain all terms specified byLIST
, in any order, possibly with other terms in between.LIST
is a comma-separated list of integers, e.g."1,2,3"
.--consec LIST
: Find sequences that contain all terms specified byLIST
, in the specified order, with no other terms in between.LIST
is a comma-separated list of integers, e.g."1,2,3"
.--noterms LIST
: Find sequences that do not contain any term specified byLIST
.LIST
is a comma-separated list of integers, e.g."1,2,3"
.--minmin INTEGER
: Find sequences whose smallest term isINTEGER
or greater.--minmax INTEGER
: Find sequences whose smallest term isINTEGER
or smaller.--maxmin INTEGER
: Find sequences whose greatest term isINTEGER
or greater.--maxmax INTEGER
: Find sequences whose greatest term isINTEGER
or smaller.--termorder ORDER
: Find sequences whose terms are inORDER
.ORDER
is one of the following:a
= (non-strictly) ascending (e.g. 1, 1, 2, …)d
= (non-strictly) descending (e.g. 2, 2, 1, …)n
= neither ascending or descending (e.g. 1, 2, 1, …)y
= any (the default).
--distinct DISTINCT
: Find sequences with distinct values?DISTINCT
is one of the following:y
= yes (find sequences whose values are all distinct)n
= no (find sequences containing at least some duplicate values)a
= any (the default)
--sort ORDER
: Print results inORDER
.ORDER
is one of the following:a
= by A-number (the default)d
= by descriptiont
= by terms.
--format FORMAT
: Print information about each sequence inFORMAT
.FORMAT
is one of the following:m
= A-number, description and terms on multiple lines (the default)adt
= A-number, description and terms on a single linead
= A-number and description on a single lineat
= A-number and terms on a single linea
= A-number on a single line.
--printfirst INTEGER
: Do not print more thanINTEGER
first terms of each sequence.INTEGER
must be 0 or greater. 0 means all terms are printed. The default is 0.
--namefile FILE
: Read A-numbers and names of sequences fromFILE
. Default:names
.--termfile FILE
: Read A-numbers and terms of sequences fromFILE
. Default:stripped
.--quiet
: Do not print status messages ("reading file..." etc.).-h
or--help
: print a short summary of these command line arguments and exit.
$ python3 oeissearch.py --descr "prime" --terms "1,4,5,9,64" --termorder a \
--distinct y --sort d
Searching 'names'...
Searching 'stripped'...
Found 256 sequence(s).
A051038: 11-smooth numbers: numbers whose prime divisors are all <= 11.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 27,
28, 30, 32, 33, 35, 36, 40, 42, 44, 45, 48, 49, 50, 54, 55, 56, 60, 63, 64, 66,
70, 72, 75, 77, 80, 81, 84, 88, 90, 96, 98, 99, 100, 105, 108, 110, 112, 120,
121, 125, 126, 128, 132, 135, 140
A080197: 13-smooth numbers: numbers whose prime divisors are all <= 13.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 22, 24, 25,
26, 27, 28, 30, 32, 33, 35, 36, 39, 40, 42, 44, 45, 48, 49, 50, 52, 54, 55, 56,
60, 63, 64, 65, 66, 70, 72, 75, 77, 78, 80, 81, 84, 88, 90, 91, 96, 98, 99,
100, 104, 105, 108, 110, 112, 117, 120
(snip)
$ python3 oeissearch.py --consec 19,84 --maxmax 200 --format ad --quiet
A065266: A065264 conjugated with A059893, inverse of A065265.
A065290: A065288 conjugated with A059893, inverse of A065289.
A173823: a(n) shows the digit sum of a(n+1) + a(n+2).
A191514: Lehrer's elementary sequence.
A294886: Sum of deficient proper divisors of n.
A340587: a(n) is the least root of A340586(n).