A063720 Number of segments lit in a 7-segment display (as on a calculator) to represent the number n, variant 0: '6', '7' and '9' use 5, 3 and 5 segments, respectively.
6, 2, 5, 5, 4, 5, 5, 3, 7, 5, 8, 4, 7, 7, 6, 7, 7, 5, 9, 7, 11, 7, 10, 10, 9, 10, 10, 8, 12, 10, 11, 7, 10, 10, 9, 10, 10, 8, 12, 10, 10, 6, 9, 9, 8, 9, 9, 7, 11, 9, 11, 7, 10, 10, 9, 10, 10, 8, 12, 10, 11, 7, 10, 10, 9, 10, 10, 8, 12, 10, 9, 5, 8, 8, 7, 8, 8, 6, 10, 8, 13, 9, 12, 12, 11, 12
Offset: 0
Examples
The number 8 on a digital readout (e.g., on a calculator display) can be represented as - | | - | | - which uses all 7 segments. Therefore a(8) = 7. From _M. F. Hasler_, Jun 17 2020: (Start) This sequence uses the following representations: _ _ _ _ _ _ _ | | | _| _| |_| |_ |_ | |_| |_| |_| | |_ _| | _| |_| | |_| | . See crossrefs for other variants. (End)
Links
Crossrefs
Programs
-
Haskell
a063720 n = a063720_list !! n a063720_list = [6,2,5,5,4,5,5,3,7,5] ++ f 10 where f x = (a063720 x' + a063720 d) : f (x + 1) where (x',d) = divMod x 10 -- Reinhard Zumkeller, Mar 15 2013
-
Mathematica
a[n_ /; n <= 9] := a[n] = {6, 2, 5, 5, 4, 5, 5, 3, 7, 5}[[n+1]]; a[n_] := a[n] = a[Quotient[n, 10]] + a[Mod[n, 10]]; Table[a[n], {n, 0, 85}] (* Jean-François Alcover, Aug 12 2013, after Reinhard Zumkeller *) Table[Total[IntegerDigits[n]/.{0->6,1->2,2->5,3->5,6->5,7->3,8->7,9->5}],{n,0,90}] (* Harvey P. Dale, Mar 27 2021 *)
-
PARI
apply( {A063720(n)=digits(6255455375)[n%10+1]+if(n>9, self()(n\10))}, [0..99]) \\ M. F. Hasler, Jun 17 2020
Formula
a(n) = a(floor(n/10)) + a(n mod 10) for n > 9. - Reinhard Zumkeller, Mar 15 2013
Extensions
More terms from Matthew Conroy, Sep 13 2001
Definition clarified by M. F. Hasler, Jun 17 2020
Comments