|
|
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.
(Formerly M4049)
|
|
26
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
COMMENTS
|
If we mark with * resp. ' the graphical representations which use more resp. less segments, we have the following variants:
|
|
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).
|
|
LINKS
|
Netnews group rec.puzzles, Frequently Asked Questions (FAQ) file, Instructions problem series.31, and Series Section solution series.31.
|
|
FORMULA
|
|
|
EXAMPLE
|
As depicted below, zero uses 6 segments, so a(0)=6.
_ _ _ _ _ _ _ _
| | | _| _| |_| |_ |_ | |_| |_|
|_| | |_ _| | _| |_| | |_| _|
.
|
|
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 *)
|
|
PROG
|
(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
(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))
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn,nice,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|