This site is supported by donations to The OEIS Foundation.

B-files

From OeisWiki
(Redirected from B-file)
Jump to: navigation, search

b-files provide many more terms of a sequence than the typical fifty to eighty terms that can be shown in the main sequence entry (lines prefixed with %S, %T, %U in the internal format). Generally this means the first thousand or ten thousand terms, sometimes the first hundred thousand terms, depending on how large the terms get and how many can be computed.

In regards to finite sequences, there are cases in which the b-file gives all the terms of the sequence. We have started marking such b-files by adding "(complete sequence)" after the b-file link in the entry (e.g., A001476) and giving these sequences keyword:full.

The lines of a b-file should not generally exceed 1000 characters in length, since some tools cannot handle long lines.

If no b-file has been uploaded for a particular sequence, the server generates a b-file containing exactly the terms displayed, for convenience with automated tools.

Format of b-files


The format of files is UTF-8, but note that Unicode byte-order marks (EF BB BF) are not allowed. [Thus the encoding is UTF-8 w/o BOM rather than UTF-8.] b-files use the ASCII subset of UTF-8: no high bits are set.[1]
Note that b-files follow a very strict plain text format (i.e. only ASCII printable characters and LF, the line feed ASCII control character; ANSI characters corresponding to codes 128 to 255 are NOT allowed and Unicode code points above U+007E are NOT allowed) which enables their information to be easily extracted.
The filename is the lowercase letter "b" followed by the A-number of the applicable sequence (without the prefix "A") and then the [plain text] file extension ".txt". Within the file, each line has n, a space (NOT a horizontal tab ASCII control character), a(n) and a Unix-style newline (LF, the line feed ASCII control character). The last line requires a trailing line feed ASCII control character, otherwise the OEIS software will count n-1 entries instead of n entries. However, "thanks to help from Brendan McKay," Neil Sloane "automated the process that converts non-Unix b-files to Unix format, and also replaces tab characters with spaces" so that contributors may freely use DOS/Windows and traditional Mac (pre Mac OS X) text editors to make b-files.[2]

The indices n in the file (discarding the comment lines) must be consecutive; the first n being the same as the offset. In consequence there are no means to indicate missing/unknown intermediate terms.

The indices n in the file are the serialized enumeration obtained by reading the triangles or arrays in the order described in the database -- typically line by line or along some (anti)diagonals, starting with the offset. So the b-files do NOT use two (row and column) indices for entries with the tabl or tabf tags.

Thus, for example, if the 370 th term of a sequence is 94611056096305838013295371573764256526437182762229865607320618320601813254535, then line 370 of the b-file should read (without a space before 370)

370 94611056096305838013295371573764256526437182762229865607320618320601813254535

The 370 is followed by a space (although NOT preceded by a space) and then the 370 th term itself, then a new line. The next line has 371, followed by a space and then the 371st term of that sequence.

Here for example are the first few and the last few lines out of the b-file for A000040, the prime numbers in (as you can verify, ):

1 2
2 3
3 5
4 7
...
9998 104717
9999 104723
10000 104729

You may add comment lines by starting a line with # followed by a space and a comment line. The typical application are comment lines

  1. that are time stamps to indicate when the b-file was created;
  2. detailing from which source/literature the numbers were extracted;
  3. providing the source code of programs that produced the terms if that is too spacious for the tagged lines of the main database.

Contributing a b-file to the OEIS

Cf. Contributing a b-file or other file to the OEIS.

See also

Notes

External links