sloane - lookup integer sequences, OEIS A-numbers, etc.
sloane [-n N] [--all] [--oeis] TERMS...
sloane [--invert] --filter
sloane (--update|--version|--help)
sloane
provides a command line interface to Sloane's OEIS (The On-Line Encyclopedia of Integer Sequences). It can be used offline (the default) as well as online (with the --oeis
option). The first time sloane
is used in offline mode the user will be asked to run sloane --update
. This will download https://oeis.org/{names.gz,stripped.gz}
and unpack them into .oeis-data/{names,stripped}
in the home directory. Alternatively, one can do this by hand using wget
and gunzip
, say, if prefered.
A common way to use sloane
is to search for entries matching a sequence of consecutive terms:
sloane 1,3,19,183,2371,38703
At the time of writing this would return
{
"trail": ["{1,3,19,183,2371,38703}"],
"hops": "A006531",
"name": "Semiorders on n elements.",
"seq": [1,1,3,19,183,2371,38703,763099,17648823,468603091,...]
}
The --filter
option can be very useful when checking a large number of sequences. In this mode sloane
expects input in the form returned by hops(1). It reads standard input line-by-line, if the sequence in the right hand side of the entry read is in the local database, then the entry is returned to standard output; if not, it is ignored. This way one can quickly filter out the sequences from the input that are in the local database. To also lookup the names of those sequences one could run
sloane --filter <FILE | sloane
If the sequences one wishes to filter are not already in form returned by hops
then one may mold them into that form using hops --tag
. See the EXAMPLES section for more usage examples.
--filter
).
Lookup A-numbers:
$ sloane A000111 A000112
{
"hops": "A000111",
"name": "Euler or up/down numbers: e.g.f. sec(x) + tan(x)...",
"seq": [1,1,1,2,5,16,61,272,1385,7936,50521,353792,2702765,22368256,...]
}
{
"hops": "A000112",
"name": "Number of partially ordered sets (\"posets\") with n unlabeled elements.",
"seq": [1,1,2,5,16,63,318,2045,16999,183231,2567284,46749427,...]
}
Lookup a sequence (limit to at most two results):
$ sloane -n2 1,1,2,5,15,52,203,877,4140,21147,115975,678570
{
"trail": ["{1,1,2,5,15,52,203,877,4140,21147,115975,678570}"],
"hops": "A000110",
"name": "Bell or exponential numbers: number of ways to partition a set of n...",
"seq": [1,1,2,5,15,52,203,877,4140,21147,115975,678570,4213597,27644437,...]
}
{
"trail": ["{1,1,2,5,15,52,203,877,4140,21147,115975,678570}"],
"hops": "A192127",
"name": "Number of set partitions of {1, ..., n} that avoid 6-nestings.",
"seq": [1,1,2,5,15,52,203,877,4140,21147,115975,678570,4213596,27644383,...]
}
Lookup a sequence generated by hops(1):
$ hops 'y=1+integral(2*y^2-y);laplace(y)' | sloane
{
"trail":["y=1+integral(2*y^2-y);laplace(y)"],
"hops":"A000670",
"name":"Fubini numbers: number of preferential arrangements of n labeled ...",
"seq":[1,1,3,13,75,541,4683,47293,545835,7087261,102247563,1622632573,...]
}
{
"trail":["y=1+integral(2*y^2-y);laplace(y)"],
"hops":"A034172","name":"Nearest integer to n!/(2*log(2)^(n+1)).",
"seq":[1,1,3,13,75,541,4683,47293,545835,7087261,102247563,1622632573,...]
}
Fetch the OEIS entry whose A-number is A006531:
sloane --oeis id:A006531
Return at most 3 results of a free text search:
sloane -n 3 --oeis "(2+2)-free posets"
Please use the --oeis
option with some moderation as not to overburden the OEIS-server; see OEIS' policy on searching the database.
hops(1) http://akc.is/hops
Source code for sloane
: http://akc.is/sloane
Anders Claesson http://akc.is