This site is supported by donations to The OEIS Foundation.

# B-files

(Redirected from B-file)

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

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 characters, whether unibyte or multibyte, 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.[1]

Thus, for example, if the 370th 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 370th 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 $\scriptstyle \Z^{+} \,$ (as you can verify, $\scriptstyle \pi(104729) \,=\, 10^4 \,$):

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


You may add comment lines at the beginning of a b-file by starting a line with # followed by a space and a comment line.