login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A371477
Positive integers that can be represented in an 8-bit floating point format.
0
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 30, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 88, 96, 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240
OFFSET
1,2
COMMENTS
A floating point number representation as a bit string consists of a sign bit, some bits for an exponent for a power of two and the remaining bits are for a mantissa for a fixed point number.
In this 8-bit format, there is one sign bit (S), four exponent bits (E) and three mantissa bits (M). These 8-bit strings correspond to rational numbers (-1)^S * 1.M * 2^(E-7), where 1.M and E are interpreted as numbers written in binary (note the exponent bias of 7), except when the exponent bit string is 0000 or 1111. See Burch or Wikipedia for more details on this format.
This is not the only possible apportionment of the bits. E.g. Verts (2005) proposes an 8-bit format with three exponent bits and four mantissa bits. In the Verts system, the only positive integers that can be represented are the integers from 1 to 15.
LINKS
EXAMPLE
18 is in the sequence because it can be represented as 0 1011 001, meaning sign bit 0, exponent 11-7 = 4, and tacit leading 1 plus explicit 1/8 for the mantissa. The corresponding number in binary is then 1.001 * 10^(1011-111), or in decimal 1.125 * 2^(11-7) = 9/8 * 16 = 18.
19 is not in the sequence because it would require at least four mantissa bits.
20 is in the sequence because it can be represented as 0 1011 010.
256 is not in this sequence because it would require exponent 8, so the exponent bits would be 1111 (15 in binary, with 15-7 = 8), but that exponent bit string is reserved for a special, non-numerical interpretation. 512 or 1024 are also not in this sequence because their exponents do not fit into four bits (taking into account the bias of 7).
PROG
(Scala) def oddPart(n: Int): Int = {
if (n == 0) {
0
} else {
var num = n
while (num % 2 == 0) {
num >>= 1
}
num
}
}
(1 to 255).filter(oddPart(_) < 16)
CROSSREFS
Cf. A000265 (odd part of n).
Sequence in context: A204315 A032966 A122937 * A246076 A246082 A060340
KEYWORD
nonn,fini,full
AUTHOR
Alonso del Arte, Mar 25 2024
STATUS
approved