The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A249919 Number of LCD (liquid-crystal display) segments needed to display n in binary. 1
 6, 2, 8, 4, 14, 10, 10, 6, 20, 16, 16, 12, 16, 12, 12, 8, 26, 22, 22, 18, 22, 18, 18, 14, 22, 18, 18, 14, 18, 14, 14, 10, 32, 28, 28, 24, 28, 24, 24, 20, 28, 24, 24, 20, 24, 20, 20, 16, 28, 24, 24, 20, 24, 20, 20, 16, 24, 20, 20, 16, 20, 16, 16, 12, 38, 34, 34, 30, 34, 30, 30, 26, 34, 30, 30, 26, 30, 26, 26 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,1 COMMENTS The "LCD" refers to how 0 and 1 are displayed, such that zero is represented with 6 lines, and one is represented with 2 lines:    _   | |        |   |_|  and   | LINKS Indranil Ghosh, Table of n, a(n) for n = 0..32768 FORMULA The formulas below do not include a(0)=6: a(2^(n-1)) = 2 + 6(n-1). a((2^n)-1) = 2n. a(x] = a(2^(n+1) + (2^n)-1) = a(2^(n+2)-1) + 4. a(y] = a(2^(n+1) + (2^n)) = a(2^(n+1)) - 4. a(x - u) + 6 = a(x - u + 2^(n+1)). a(y + u) + 6 = a(y + u + 2^(n+1)). a(2^(n+1)) + a(2^(n+2)-1) = a(x - u) + a(y + u). where n=1, 2, ... and u=0, ..., (2^n)-2. a(n) = A010371(A007088(n)). - Michel Marcus, Aug 01 2015 EXAMPLE For n = 4, 4 = 100_2. So, a(4) = 2 + 6 + 6 = 14. - Indranil Ghosh, Feb 02 2017 MATHEMATICA f[n_] := Total[{2, 6}*(Count[ IntegerDigits[n, 2], #] & /@ {1, 0})]; Array[f, 79, 0] (* Robert G. Wilson v, Jul 26 2015 *) PROG (PARI)  a(n)=if(n==0, 6, 6*#binary(n) - 4*hammingweight(n)); \\ Charles R Greathouse IV, Feb 28 2015 (C) // Input: n (no negative offset/term number), Output: a(n) int A249919 (int n) {    int m=0, r=0;    if (n) {       while (n!=1) {          m=n&1; //equivalent to m=n%2;          n=n>>1; //equivalent to n/=2;          if (m) {             r+=2;          } else {             r+=6;          }       }       r+=2;    } else {       r+=6;    }    return r; } // Arlu Genesis A. Padilla, Jun 18 2015 (Python) def A249919(n): ....x=bin(n)[2:] ....s=0 ....for i in x: ........s+=[6, 2][int(i)] ....return s # Indranil Ghosh, Feb 02 2017 CROSSREFS Cf. A007088, A010371, A074458. Sequence in context: A098686 A079718 A062771 * A254868 A071874 A011331 Adjacent sequences:  A249916 A249917 A249918 * A249920 A249921 A249922 KEYWORD easy,nonn,base AUTHOR Arlu Genesis A. Padilla, Jan 14 2015 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified May 5 19:31 EDT 2021. Contains 343573 sequences. (Running on oeis4.)