This site is supported by donations to The OEIS Foundation.

User:M. F. Hasler/Categories

From OeisWiki
Jump to: navigation, search

Categories of sequences

Categories, as described here, are a generalization of the existing keywords, making them much more flexible and powerful. The implementation would require almost no work at all, and the main benefit would be to get for free an automatically created & more informative index that could supersede the current Index to OEIS and avoid the hassle of manually creating links from OEIS entries to Index entries and back.


The purpose of Categories is to add a general, precise, flexible, easy-to-use (and to implement!), intuitive and powerful method for

  1. classifying and indexing sequences
  2. linking from one sequence to others ("cross-references"), in a simple but meaningful way

with almost no server software change required.

These categories are nothing else than free keywords, with additional search features that can be added incrementally.


The suggested implementation requires nearly no work at all, and each step of this implementation is

  1. backward compatible (everything that exists will still work as before)
  2. adding additional functionality on its own, without requiring to proceed to the next step in order to have some benefit.

See below for more technical details.

Level 1: remove restrictions on allowed keywords

Level 1 of implementation: Simply allow completely general, user-defined keywords or key phrases ("Riemann hypothesis", "Zeta function", ...) to be entered into the keyword section, in addition to the classical ones like nonn,easy,tabl,.... (The editors who must anyway validate any edit, might slightly moderate the introduction of new keywords or key phrases to avoid abuse, in particular introduction of too specific keywords.)

Level 2: render new keywords as link to search for the keyword

Level 2 of implementation: Any keyword/keyphrase not among the list of otherwise defined "classical" keywords is considered as "Category". This means it is rendered as a link which will do a search for all sequences having this same keyword (or having the name Category:<this-keyphrase>).

Just as for the "cons" and "tabl" keywords, a minimal HTML tag would be (dynamically) added around any keyword not among the classical ones (or alternatively: any capitalized keyword), i.e., a link <A HREF="/search?q=keyword:This-Category&fmt=short">This Category</A>. Clicking on that link shows the list of all sequences with this keyword, i.e., in that category.

Level 3: special display of Category "header pages"

Level 3 of implementation: Special display routines for sequences named "Category:<anything>". Such (pseudo)sequences,

  • created and edited as any other sequence (without the requirement of having DATA and OFFSET)
  • hold a more developed description and further information about this category
  • could be displayed in some particular manner when the "Category is displayed" (i.e., search for "keyword:Name-of-that-Category")
  • can have again Category keywords, making the present category a sub-category of others.
  • could hold, in the DATA field, a list of subcategories or sequences (maybe: to be displayed on top of other "search results" = category member sequences, and/or for performance issues).

In turn, sub-categories of a given category could be displayed in a special manner at top or bottom of the "search results" = category member sequences.

It could be desired to display the search results (member sequences of a category) in a (slighly to radically) shorter style:

  1. Display only A-number, title, offset and data
  2. Display only A-number, title and 1 line of data
  3. Display only A-number and title, limited to 1 line, data available as "popup"
  4. Display only A-number and data limited to 1 line, title available as "popup"
  5. Display only the A-numbers, titles available as "popup"

Technical details

Historical introduction

In reply to a mail from Charles R Greathouse IV, I developed the following idea:

To implement wiki-style, arbitrarily nested and user-editable categories on the main OEIS, it would be sufficient to allow arbitrary keywords, which would, e.g., as soon as they start with an initial capitalized letter, represent categories. As such, these keywords should simply link to a search for "keyword:Nnnn", which would display entries having either "Category:Nnnn" as name (listed first - this would represent the header of the actual "Category" page), or which have "Nnnn" as Keyword.

(Sequence) category "header pages"

Thus, a Category header page would be nothing else than a sequence having the special name "Category:Nnnn" and (a priori) no data (%S %T %U etc. lines) [unless this would be used internally for performance reasons, e.g., to store the list of sequences linking to that category].

Thus, description, comments, and classification of (new) categories could be added exactly in the same way as for sequences.

The %N would be the "title" of the category (maybe simply the key phrase, or "Category:Key phrase") the %C could include a textual description of the category -- AND/OR simply any related comments, just as for sequences (and actually the same could make sense for other fields, as references, links, cross-references...).

Thus, in a minimalist approach, no special additional field would be needed. The only structure pertaining to categories is the inclusion of items (sequences) and (sub)categories "inside" a category, but this is simply (and already) implemented by adding the (parent) category, in which a given item (sequence or category) is filed, in the %Keyword field.

So the link to the category ("underlined" keyword) could also be simply a link to a search for the key phrase. Such a search would bring up the "Category:" entry itself (if necessary, this should be enforced to be displayed as first hit, but probably would be already the case by default behaviour), and as subsequent hits, other categories and sequences filed within this category (i.e., having it as keyword:). If the simple search for the keyword does not the right job or is feared to be inefficient, one could also imagine a link "".

So, the only modification to implement would be a slightly modified display routine for the KEYWORDS field (to display Categories separately from the other old four-letter keywords, and with the before mentioned link to an adequate search), and maybe a minor tweak in the search routine, for handling "q=Category:xxxx" as equivalent to q=name:"Category:xxxx"|keyword:xxxx, and where the hits to the first part should be displayed first, and maybe (sub)categories (= "Category headers" having this KW) should maybe also be displayed before the other sequences having that KW. — M. F. Hasler 08:28, 26 January 2012 (UTC)