login
Decimal value of the bitmap of active segments in 7-segment display of the number n, variant 2 ("abcdefg" scheme: bits represent segments in clockwise order).
11

%I #28 Mar 09 2024 10:31:37

%S 63,6,91,79,102,109,125,39,127,111,831,774,859,847,870,877,893,807,

%T 895,879,11711,11654,11739,11727,11750,11757,11773,11687,11775,11759,

%U 10175,10118,10203,10191,10214,10221,10237,10151,10239,10223,13119,13062,13147,13135,13158

%N Decimal value of the bitmap of active segments in 7-segment display of the number n, variant 2 ("abcdefg" scheme: bits represent segments in clockwise order).

%C The bits 0-6 are assigned to the segments according to the "abcdefg" scheme (top, upper right, lower right, bottom, lower left, upper left, center), cf. section "Displaying letters" of the Wikipedia page (3rd column of the table). Other conventions are common in engineering (as well for the segment-to-bit correspondence as for the glyphs), see sequence A234691, the Wikipedia page and the comment after the Example for a(7).

%C For n > 9, each of the digits of the base-10 representation is coded in a separate group of 7 bits, for example, a(10) = a(1)*2^7 + a(0) = 831.

%C Alternatively, for n >= 10 one could define a(n) to represent a 7-segment variant of the characters A-Z and/or a-z, as in hexadecimal or base-64 encoding. In that case, one could also use a few more bits for additional segments, e.g., four half-diagonals to represent K, M, N, R, V, X, Z correctly and S distinctly from 5. But as mentioned on the Wikipedia page, a possible ambiguity of representations of alphabetic characters is not always an obstacle to common use, since whole words are usually readable nonetheless.

%C The Hamming weight A000120 of the terms of this sequence yields the count of lit segments, A010371(n) = A000120(a(n)) = A000120(A234691(n)). For that sequence, 5 other variants are in the OEIS, depending on the number of segments used to represent digits 6, 7 and 9: A063720 (6', 7', 9'), A277116 (7', 9'), A074458 (9') and A006942 (7'), where x' means that the "sans serif" variant (one segment less than here) is used for digit x. - _M. F. Hasler_, Jun 17 2020

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Seven-segment_display">Seven-segment display</a>.

%F a(n) = a(n mod 10) + a(floor(n/10))*2^7. - _M. F. Hasler_, Jun 17 2020

%e a(7) = 39 = 2^0 + 2^1 + 2^2 + 2^5, because the digit 7 is represented as

%e " _ " : bit 0,

%e "| |" : bits 5+1,

%e " |" : bit 2,

%e and no bit 3 (bottom "_") nor 4 (lower left "|") nor 6 (central "-").

%e Although other glyphs do exist as well for 6, 9, 0 and maybe other digits, "7" is probably the digit where an alternate representation (without the upper left "|") is as common as the one we chose here.

%o (PARI) bitmap=apply(s->sum(i=1,#s=Vec(s),if(s[i]>" ",2^(i-1))), ["000000"," 11", "22 22 2", "3333 3", " 44 44", "5 55 55", "6 66666", "777 7", "8888888", "9999 99", "AAA AAA", " bbbbb", "C CCC "," dddd d", "E EEEE", "F FFF"]) \\ Could be extended to more alphabetical glyphs, see A234691.

%o apply( {A234692(n)=bitmap[n%10+1]+if(n>9,self()(n\10)<<7)}, [0..99]) \\ _M. F. Hasler_, Jun 17 2020

%Y Cf. A234691 for a variant where bits 0-6 represent, in this order, the segments: top, upper left, upper right, center, lower left, lower right, bottom.

%Y Cf. A000120 (Hamming weight), A010371 and variants A063720, A277116, A074458 and A006942: see comments.

%K nonn,base

%O 0,1

%A _M. F. Hasler_, Dec 29 2013

%E Extended with hex digits (AbCdEF) to n=15 by _M. F. Hasler_, Dec 30 2013

%E a(10) and a(11) corrected thanks to _Kevin Ryde_, _M. F. Hasler_, Jun 16 2020

%E Definition changed for consistency with A010371, etc. by _M. F. Hasler_, Jun 17 2020