cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-6 of 6 results.

A006942 Number of segments used to represent n on calculator display, variant 5: digits '6', '7' and '9' use 6, 3 and 6 segments, respectively.

Original entry on oeis.org

6, 2, 5, 5, 4, 5, 6, 3, 7, 6, 8, 4, 7, 7, 6, 7, 8, 5, 9, 8, 11, 7, 10, 10, 9, 10, 11, 8, 12, 11, 11, 7, 10, 10, 9, 10, 11, 8, 12, 11, 10, 6, 9, 9, 8, 9, 10, 7, 11, 10, 11, 7, 10, 10, 9, 10, 11, 8, 12, 11, 12, 8, 11, 11, 10, 11, 12, 9, 13, 12, 9, 5, 8, 8, 7, 8, 9
Offset: 0

Views

Author

Keywords

Comments

a(A216261(n)) = n and a(m) <> n for m < A216261(n). - Reinhard Zumkeller, Mar 15 2013
If we mark with * resp. ' the graphical representations which use more resp. less segments, we have the following variants:
A063720 (6', 7', 9'), A277116 (6*, 7', 9'), A074458 (6*, 7*, 9'),
_____________ this: A006942 (6*, 7', 9*), A010371 (6*, 7*, 9*).
Sequences A234691, A234692 and variants make precise which segments are lit in each digit. These are related through the Hamming weight function A000120, e.g., A010371(n) = A000120(A234691(n)) = A000120(A234692(n)). - M. F. Hasler, Jun 17 2020

Examples

			As depicted below, zero uses 6 segments, so a(0)=6.
   _     _  _       _   _   _   _   _
  | | |  _| _| |_| |_  |_    | |_| |_|
  |_| | |_  _|   |  _| |_|   | |_|  _|
.
[Edited by _Jon E. Schoenfield_, Jul 30 2017]
		

References

  • Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 65.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A216261 (least inverse), A165244 (sorted digits), A302552 (primes), A328330 (iterations), A331529 (histogram).
Variants are A010371, A063720, A074458, A277116, see comments.
See also A234691, A234692, A000120.

Programs

  • Haskell
    a006942 n = a006942_list !! n
    a006942_list = [6,2,5,5,4,5,6,3,7,6] ++ f 10 where
       f x = (a006942 x' + a006942 d) : f (x + 1)
             where (x',d) = divMod x 10
    -- Reinhard Zumkeller, Mar 15 2013
    
  • Maple
    A006942 := proc(n) local d,dig,j,s: if(n=0)then return 6:fi: dig:=[6,2,5,5,4,5,6,3,7,6]: d:=convert(n,base,10): s:=0: for j from 1 to nops(d) do s:=s+dig[d[j]+1]: od: return s: end: seq(A006942(n),n=0..100); # Nathaniel Johnston, May 08 2011
  • Mathematica
    MapIndexed[ (f[First[#2] - 1] = #1)& , {6, 2, 5, 5, 4, 5, 6, 3, 7, 6}]; a[n_] := Plus @@ f /@ IntegerDigits[n]; Table[a[n], {n, 0, 76}] (* Jean-François Alcover, Sep 25 2012 *)
    a[n_] := Plus @@ (IntegerDigits@ n /. {0 -> 6, 1 -> 2, 2 -> 5, 3 -> 5, 7 -> 3, 8 -> 7, 9 -> 6}); Array[a, 77, 0] (* Robert G. Wilson v, Jun 20 2018 *)
  • PARI
    a(n)=if(n==0, return(6)); my(d=digits(n),v=vector(10)); for(i=1,#d, v[d[i]+1]++); v*[6, 2, 5, 5, 4, 5, 6, 3, 7, 6]~ \\ Charles R Greathouse IV, Feb 05 2018
    
  • Python
    def a(n): return sum([6, 2, 5, 5, 4, 5, 6, 3, 7, 6][int(d)] for d in str(n))
    print([a(n) for n in range(77)]) # Michael S. Branicky, Jun 02 2021

Formula

a(n) = a(floor(n/10)) + a(n mod 10) for n > 9. - Reinhard Zumkeller, Mar 15 2013
a(n) = A010371(n) - A102679(n) + A102681(n) (subtract the number of digits 7 in n) = A277116(n) + A102683(n) (add number of digits 9 in n); and in particular, A063720(n) <= A277116(n) <= a(n) = A010371(n). - M. F. Hasler, Jun 17 2020

Extensions

More terms from Matthew Conroy, Sep 13 2001

A010371 Number of segments used to represent n on a 7-segment calculator display; version where '6', '7' and '9' use 6, 4 and 6 segments, respectively.

Original entry on oeis.org

6, 2, 5, 5, 4, 5, 6, 4, 7, 6, 8, 4, 7, 7, 6, 7, 8, 6, 9, 8, 11, 7, 10, 10, 9, 10, 11, 9, 12, 11, 11, 7, 10, 10, 9, 10, 11, 9, 12, 11, 10, 6, 9, 9, 8, 9, 10, 8, 11, 10, 11, 7, 10, 10, 9, 10, 11, 9, 12, 11, 12, 8, 11, 11, 10, 11, 12, 10, 13, 12, 10, 6, 9, 9, 8, 9, 10, 8, 11, 10, 13, 9, 12, 12
Offset: 0

Views

Author

Olivier.Gagneux(AT)roche.com

Keywords

Comments

Except for 1 and 3 every positive integer occurs; A143616 and A143617 give record values and where they occur. - Reinhard Zumkeller, Aug 27 2008
The difference between this sequence and A006942 lies in the representation chosen for the digit 7,
| | |
| (here), vs. | in A006942.
If we mark with ' the "sans serif" graphical representation which uses one segment less and with * the "heavier" version, we have the following variants:
A063720 (6', 7', 9'), A277116 (6*, 7', 9'), A074458 (6*, 7*, 9'),
___________________ A006942 (6*, 7', 9*), A010371 (6*, 7*, 9*) = this.
Sequences A234691, A234692 and variants make precise which segments are lit in each digit. They are related through the Hamming weight A000120, see formula. The sequence could be extended to negative arguments with a(-n) = a(n)+1. - M. F. Hasler, Jun 17 2020

Examples

			LCD Display (cf. Casio scientific calculator fx-3600P):
   _     _  _       _   _   _   _   _
  | | |  _| _| |_| |_  |_  | | |_| |_|
  |_| | |_  _|   |  _| |_|   | |_|  _|
		

Crossrefs

Segment variations: A006942, A063720, A074458, A277116.

Programs

  • Haskell
    a010371 n = a010371_list !! n
    a010371_list = [6,2,5,5,4,5,6,4,7,6] ++ f 10 where
       f x = (a010371 x' + a010371 d) : f (x + 1)
             where (x',d) = divMod x 10
    -- Reinhard Zumkeller, Mar 15 2013
    
  • Mathematica
    MapIndexed[(f[#2[[1]]-1] = #1)&, {6, 2, 5, 5, 4, 5, 6, 4, 7, 6}]; a[n_] := Total[f /@ IntegerDigits[n]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Mar 08 2017 *)
  • PARI
    apply( {A010371(n)=digits(6255456476)[n%10+1]+if(n>9, self()(n\10))}, [0..99]) \\ M. F. Hasler, Jun 17 2020

Formula

For n > 9, a(n) = a(floor(n/10)) + a(n mod 10). - Reinhard Zumkeller, Aug 27 2008
a(n) = A000120(A234691(n)) = A000120(A234692(n))
= A006942(n) + A102679(n) - A102681(n) (add number of digits 7)
= A074458(n) + A102683(n) (add number of digits 9). - M. F. Hasler, Jun 17 2020

Extensions

Corrected and extended by Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de), Dec 27 1999
Edited name, comments, cross-references. - M. F. Hasler, Jun 17 2020

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.

Original entry on oeis.org

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

Views

Author

Deepan Majmudar (deepan.majmudar(AT)compaq.com), Aug 23 2001

Keywords

Comments

If we mark with * resp. ' the glyph variants (graphical representations) which use more resp. less segments, we have the following variants:
A063720 (this: 6', 7', 9'), A277116 (6*, 7', 9'), A074458 (6*, 7*, 9'), _________________________ A006942 (6*, 7', 9*), A010371 (6*, 7*, 9*). Sequences A234691, A234692 and variants make precise which segments are lit in each digit. These are related through the Hamming weight function A000120, e.g., A010371(n) = A000120(A234691(n)) = A000120(A234692(n)). - M. F. Hasler, Jun 17 2020

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)
		

Crossrefs

For variants see A006942, A010371, A074458, A277116 (cf. comments).
Other related sequences: A018846, A018847, A018849, A038136, A053701.

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
a(n) <= A277116(n) <= min{A006942(n), A074458(n)} <= A010371(n); differences between these are given, e.g., by A102677(n) - A102679(n) (= number of digits 7 in n). - M. F. Hasler, Jun 17 2020

Extensions

More terms from Matthew Conroy, Sep 13 2001
Definition clarified by M. F. Hasler, Jun 17 2020

A074458 Number of segments lit to display the number n on a 7-segment display (as in pocket calculators): variant where '6', '7' and '9' use 6, 4 resp. 5 segments.

Original entry on oeis.org

6, 2, 5, 5, 4, 5, 6, 4, 7, 5, 8, 4, 7, 7, 6, 7, 8, 6, 9, 7, 11, 7, 10, 10, 9, 10, 11, 9, 12, 10, 11, 7, 10, 10, 9, 10, 11, 9, 12, 10, 10, 6, 9, 9, 8, 9, 10, 8, 11, 9, 11, 7, 10, 10, 9, 10, 11, 9, 12, 10, 12, 8, 11, 11, 10, 11, 12, 10, 13, 11, 10, 6, 9, 9, 8, 9, 10, 8, 11
Offset: 0

Views

Author

Y. Kelly Itakura (yitkr(AT)mta.ca), Aug 22 2002

Keywords

Comments

Sequences A234691 and A234692 use one bit for each lit segment. See crossrefs for other variants. - M. F. Hasler, Jun 17 2020

Examples

			LED display:
   _       _   _       _   _   _   _   _
  | |   |  _|  _| |_| |_  |_  | | |_| |_|
  |_|   | |_   _|   |  _| |_|   | |_|   |
.
so we have a(0) = 6, a(1) = 2, a(2) = 5 ...
		

Crossrefs

Cf. A074459.
For other versions of this sequence, see A006942 (7 with one segment less), A063720 (6 and 7 with one segment less), A010371 (9 with one segment more), A277116 (7 with one segment less, 9 with one segment more).

Programs

  • PARI
    apply( {A074458(n)=digits(6255456475)[n%10+1]+if(n>9,self()(n\10))}, [0..99]) \\ M. F. Hasler, Jun 17 2020

Formula

From M. F. Hasler, Jun 17 2020: (Start)
a(n) = a(n mod 10) + a(floor(n/10)) for n > 9.
a(n) = A006942(n) - A102679(n) + A102681(n). (End)

Extensions

Example edited by Jon E. Schoenfield, Jul 30 2017
Edited and extended to n > 9 by M. F. Hasler, Jun 17 2020

A277116 Number of segments used to represent the number n on a 7-segment display: variant where digits 6, 7 and 9 use 6, 3 and 5 segments, respectively.

Original entry on oeis.org

6, 2, 5, 5, 4, 5, 6, 3, 7, 5, 8, 4, 7, 7, 6, 7, 8, 5, 9, 7, 11, 7, 10, 10, 9, 10, 11, 8, 12, 10, 11, 7, 10, 10, 9, 10, 11, 8, 12, 10, 10, 6, 9, 9, 8, 9, 10, 7, 11, 9, 11, 7, 10, 10, 9, 10, 11, 8, 12, 10, 12, 8, 11, 11, 10, 11, 12, 9, 13, 11, 9, 5, 8, 8, 7, 8, 9
Offset: 0

Views

Author

Eric Ginsburg, Sep 30 2016

Keywords

Comments

Another version of A006942. Here the digit "6" is represented with six segments (the same as in A006942) but the digit "9" is represented with five segments instead of six segments. - Omar E. Pol, Sep 30 2016
If we mark with * resp. ' the graphical representations which use one more resp. one less segment, we have the following variants:
A063720 (6', 7', 9'), A277116 (6*, 7', 9'), A074458 (6*, 7*, 9'),
___________________ A006942 (6*, 7', 9*), A010371 (6*, 7*, 9*).
Sequences A234691 and A234692 make precise which segments are lit in each digit. They are related through the Hamming weight function A000120, e.g., A010371(n) = A000120(A234691(n)) = A000120(A234692(n)). - M. F. Hasler, Jun 17 2020

Examples

			For n = 29, digit '2' uses 5 segments and digit '9' uses 5 segments. So, a(29) = 10. - _Indranil Ghosh_, Feb 02 2017
The digits are represented as follows:
   _     _  _       _   _   _   _   _
  | | |  _| _| |_| |_  |_    | |_| |_|
  |_| | |_  _|   |  _| |_|   | |_|   | . - _M. F. Hasler_, Jun 17 2020
		

Crossrefs

Segment variations: A006942, A010371, A063720, A074458.

Programs

  • Mathematica
    Table[Total[IntegerDigits[n] /. {0 -> 6, 1 -> 2, 2 -> 5, 3 -> 5, 6 -> 6, 7 -> 3, 8 -> 7, 9 -> 5}], {n, 0, 120}] (* Michael De Vlieger, Sep 30 2016 *)
  • PARI
    a(n) = my(segm=[6, 2, 5, 5, 4, 5, 6, 3, 7, 5], d=digits(n), s=0); if(n==0, s=6, for(k=1, #d, s=s+segm[d[k]+1])); s \\ Felix Fröhlich, Oct 05 2016
    
  • Python
    def A277116(n):
        s=0
        for i in str(n):
            s+=[6,2,5,5,4,5,6,3,7,5][int(i)]
        return s # Indranil Ghosh, Feb 02 2017

Formula

a(n) = A006942(n) - A102683(n). - Omar E. Pol, Sep 30 2016
a(n) = A063720(n) + A102677(n) - A102679(n) (add number of digits 6)
= A074458(n) - A102679(n) + A102681(n) (subtract number of digits 7)
and thus A063720(n) <= a(n) <= min(A074458(n), A006942(n)) <= A010371(n). - M. F. Hasler, Jun 17 2020

Extensions

Better definition and more terms from Omar E. Pol, Sep 30 2016
Edited by M. F. Hasler, Jun 17 2020

A102680 Number of digits >= 7 in the decimal representations of all integers from 0 to n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 32, 34, 35, 36
Offset: 0

Views

Author

N. J. A. Sloane, Feb 03 2005

Keywords

Comments

The total number of digits >= 7 occurring in all the numbers 0, 1, 2, ..., n (in decimal representation). - Hieronymus Fischer, Jun 10 2012

Crossrefs

Partial sums of A102679.
Cf. A000120, A000788, A023416, A059015 (for base 2).

Programs

  • Maple
    p:=proc(n) local b,ct,j: b:=convert(n,base,10): ct:=0: for j from 1 to nops(b) do if b[j]>=7 then ct:=ct+1 else ct:=ct fi od: ct: end:
    seq(add(p(i),i=0..n), n=0..90);
    # Emeric Deutsch
  • Mathematica
    Accumulate[Table[Count[IntegerDigits[n],?(#>6&)],{n,0,90}]] (* _Harvey P. Dale, Sep 04 2018 *)

Formula

From Hieronymus Fischer, Jun 10 2012: (Start)
a(n) = (1/2)*Sum_{j=1..m+1} (floor(n/10^j + 7/10)*(2n + 2 - (2/5 + floor(n/10^j + 7/10))*10^j) - floor(n/10^j)*(2n + 2 - (1+floor(n/10^j)) * 10^j)), where m=floor(log_10(n)).
a(n) = (n+1)*A102679(n) + (1/2)*Sum_{j=1..m+1} (((-2/5)*floor(n/10^j + 7/10) + floor(n/10^j))*10^j - (floor(n/10^j + 7/10)^2 - floor(n/10^j)^2)*10^j), where m=floor(log_10(n)).
a(10^m-1) = 3*m*10^(m-1).
(this is total number of digits >= 7 occurring in all the numbers with <= m places).
G.f.: g(x) = (1/(1-x)^2)*Sum_{j>=0} (x^(7*10^j) - x^(10*10^j))/(1-x^10^(j+1)). (End)

Extensions

More terms from Emeric Deutsch, Feb 23 2005
Showing 1-6 of 6 results.