sloane-1.9.3: sloane.1
.TH "SLOANE" "1" "24 Sep 2014" "Sloane User Manual" "Version 1.9.3"
.SH NAME
.PP
sloane \- a command line interface to Sloane\[aq]s On\-Line Encyclopedia
of Integer Sequences <http://oeis.org>
.SH SYNOPSIS
.PP
sloane [lookup | grep] [\-a | \-\-all | \-k \f[I]keys\f[] | \-\-url]
[\-n \f[I]entries\f[]] \f[I]terms\f[] ...
.PD 0
.P
.PD
sloane filter [\-\-invert]
.PD 0
.P
.PD
sloane update
.PD 0
.P
.PD
sloane version
.SH DESCRIPTION
.PP
The \f[C]sloane\ lookup\f[] command searches Sloane\[aq]s On\-Line
Encyclopedia of Integer Sequences (OEIS).
The search terms are typically the leading term of a sequence.
For example,
.IP
.nf
\f[C]
sloane\ lookup\ 1,1,2,5,15,52,203,877,4140
\f[]
.fi
.PP
returns entry A000110 (Bell numbers), and four more entries.
If no command is given sloane will fall back to the lookup command, so
the above query can more simply be given as
.IP
.nf
\f[C]
sloane\ 1,1,2,5,15,52,203,877,4140
\f[]
.fi
.PP
One can also search by sequence id (A\-number), or even search for
arbitrary words.
See the \f[B]EXAMPLES\f[] section.
.PP
Alternatively, using the \f[C]sloane\ grep\f[] command, the search can
be done locally against a downloaded list of known sequences.
This mode works by "grepping" for the query in the sequence field.
.PP
To check a large number of sequences one can use the
\f[C]sloane\ filter\f[] command.
It reads the standard input line\-by\-line, if the sequence read is in
the local database, then it is returned to the standard output; if not,
it is ignored.
This way onw can quickly filter out the sequences from the input that
are in the local database.
In other words, assuming that \f[I]FILE\f[] contains one sequence per
line,
.IP
.nf
\f[C]
sloane\ filter\ <FILE
\f[]
.fi
.PP
returns the subset of the sequences in \f[I]FILE\f[] that are in the
local database.
To also look\-up the names of those sequences one could, for instance,
run
.IP
.nf
\f[C]
sloane\ filter\ <FILE\ |\ xargs\ \-L1\ \-\-verbose\ sloane\ grep
\f[]
.fi
.PP
Sloane normally crops long lines to fit the widths of the terminal.
If this is unwanted, pipe the output through cat or less:
.IP
.nf
\f[C]
sloane\ lookup\ \-a\ id:A000110\ |\ less\ \-R
\f[]
.fi
.SH OPTIONS
.TP
.B \-\-help
Display a short help message
.RS
.RE
.SH COMMANDS
.SS \f[C]lookup\f[]
.PP
Lookup a sequence, or other search term, in OEIS
.TP
.B \-a, \-\-all
Print all fields
.RS
.RE
.TP
.B \-k \f[I]keys\f[]
Keys of fields to print (default: SN)
.RS
.RE
.TP
.B \-\-url
Print URLs of found entries (but nothing else)
.RS
.RE
.TP
.B \-n \f[I]entries\f[]
Fetch at most this many entries (default: 5)
.RS
.RE
.SS \f[C]grep\f[]
.PP
Grep for a sequence in the local database.
Same options as for the \f[C]lookup\f[] command apply.
.SS \f[C]filter\f[]
.PP
Read sequences from stdin and return those that are in the local
database.
.TP
.B \-\-invert
Return sequences \f[I]not\f[] in the database.
.RS
.RE
.SS \f[C]update\f[]
.PP
Update the local database.
.SS \f[C]version\f[]
.PP
Print version information.
.SH EXAMPLES
.PP
The most common search is for entries matching a sequence of consecutive
terms:
.IP
.nf
\f[C]
sloane\ lookup\ 1,3,19,183,2371,38703
\f[]
.fi
.PP
At the time of writing this particular query would return
.IP
.nf
\f[C]
S\ A006531\ 1,1,3,19,183,2371,38703,763099,17648823,468603091,14050842303,
N\ A006531\ Semiorders\ on\ n\ elements.
\f[]
.fi
.PP
As this illustrates, the default is to return just the sequence (S) and
the name (N) fields.
To override the default one can use the keys option.
For instance, the following search shows the sequence, name, comments,
and formula fields of the sequence whose A\-number is A006531:
.IP
.nf
\f[C]
sloane\ lookup\ \-k\ SNCF\ id:A006531
\f[]
.fi
.PP
The next example returns at most 3 results of a free text search:
.IP
.nf
\f[C]
sloane\ lookup\ \-n\ 3\ "(2+2)\-free\ posets"
\f[]
.fi
.PP
To view the full entries of these 3 results in a browser (e.g., Firefox)
one can use the url option:
.IP
.nf
\f[C]
firefox\ `sloane\ lookup\ \-\-url\ \-n\ 3\ "(2+2)\-free\ posets"`
\f[]
.fi
.PP
In the final example the local cache is used to filter out sequences
from the standard input that are in OEIS:
.IP
.nf
\f[C]
sloane\ filter\ <<END
1,2,3,6,11,23,47,106,235\ \ \ \ \ \ \ \ \ \ \ #\ Comma\ separated\ integers
1\ 2\ 444\ 90\ 120\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ Space\ separated\ integers
\[aq](3\ 9\ 27\ 88\ 123)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ S\-expression
[2,3,5,7,11,13,17,19,23,29,31,37]\ \ #\ Haskell\ list
[1;\ 1;\ 2;\ 3;\ 5;\ 8;\ 13;\ 21]\ \ \ \ \ \ \ \ \ #\ O\[aq]Caml\ list
{1,\ \-1,\ 2,\ \-6,\ 24,\ \-120,\ 720}\ \ \ \ \ \ #\ Mathematica\ list
END
\f[]
.fi
.PP
The \[aq]#\[aq] character and any text after it is ignored by sloane.
Note also that sloane is quite liberal in the formatting of sequences it
accepts.
.SH KEYS
.PP
These are the keys used by OEIS <http://oeis.org/eishelp2.html>.
.IP
.nf
\f[C]
I\ \ ID\ number
S\ \ 1st\ line\ of\ unsigned\ sequence
T\ \ 2nd\ line\ of\ unsigned\ sequence
U\ \ 3rd\ line\ of\ unsigned\ sequence
V\ \ 1st\ line\ of\ signed\ sequence
W\ \ 2nd\ line\ of\ signed\ sequence
X\ \ 3rd\ line\ of\ signed\ sequence
N\ \ Name
C\ \ Comments
D\ \ References
H\ \ Links
F\ \ Formula
e\ \ Examples
p\ \ Maple\ program
t\ \ Mathematica\ program
o\ \ Program\ in\ other\ language
Y\ \ Cross\-references
K\ \ Keywords
O\ \ Offset
A\ \ Author
E\ \ Extensions\ and\ errors
\f[]
.fi
.SH NOTES
.PP
Please use this program with moderation as not to overburden the
OEIS\-server; see OEIS\[aq] policy on searching the database:
<http://oeis.org/wiki/Welcome#Policy_on_Searching_the_Database>.
.SH SEE ALSO
.PP
The sloane source code may be downloaded from
<https://github.com/akc/sloane>.
.SH AUTHOR
.PP
Anders Claesson <http://akc.is>