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-2 of 2 results.

A231204 If n = Sum_{i=0..m} c(i)*2^i, c(i) = 0 or 1, then a(n) = Sum_{i=0..m} (m-i)*c(i).

Original entry on oeis.org

0, 0, 0, 1, 0, 2, 1, 3, 0, 3, 2, 5, 1, 4, 3, 6, 0, 4, 3, 7, 2, 6, 5, 9, 1, 5, 4, 8, 3, 7, 6, 10, 0, 5, 4, 9, 3, 8, 7, 12, 2, 7, 6, 11, 5, 10, 9, 14, 1, 6, 5, 10, 4, 9, 8, 13, 3, 8, 7, 12, 6, 11, 10, 15, 0, 6, 5, 11, 4, 10, 9, 15, 3, 9, 8, 14, 7, 13, 12, 18, 2, 8, 7, 13, 6, 12, 11, 17, 5, 11, 10, 16, 9, 15, 14, 20, 1, 7, 6, 12
Offset: 0

Views

Author

Jon Perry, Nov 05 2013

Keywords

Comments

A literal interpretation of the binary numbers.
Sum of the number of digits to the left (exclusive) of each 1 in the binary expansion of n. - Gus Wiseman, Jan 09 2023

Examples

			For n=13 we have 1101, so we add 0+1+3=4, getting a(13)=4.
		

Crossrefs

Programs

  • JavaScript
    for (i=0;i<100;i++) {
    s=i.toString(2);
    o=0;
    sl=s.length;
    for (j=0;j
    				
  • Maple
    f:=proc(n) local t1,m,i;
    t1:=convert(n,base,2);
    m:=nops(t1)-1;
    add((m-i)*t1[i+1], i=0..m);
    end; # N. J. A. Sloane, Nov 08 2013
  • Mathematica
    Table[Total[Join@@Position[IntegerDigits[n,2],1]-1],{n,0,100}] (* Gus Wiseman, Jan 09 2023 *)
  • PARI
    a(n) = { my (b=binary(n)); sum(k=1, #b, b[k]*(k-1)) } \\ Rémy Sigrist, Jun 25 2021
    
  • Python
    def A230204(n): return sum(i for i, j in enumerate(bin(n)[2:]) if j=='1') # Chai Wah Wu, Jan 09 2023

Formula

a(n) = A230877(n) - A000120(n). - Gus Wiseman, Jan 09 2023

Extensions

Edited by N. J. A. Sloane, Nov 08 2013
Name edited by Gus Wiseman, Jan 09 2023

A377170 Sum of the nonnegative terms in the n-th row of A365968.

Original entry on oeis.org

0, 1, 4, 12, 36, 98, 250, 616, 1484, 3508, 8140, 18620, 42164, 94632, 210518, 464840, 1020556, 2229014, 4843316, 10476164, 22576728, 48489154, 103790370, 221484824, 471427432, 1001027226, 2120503144, 4482083616, 9455815160, 19913405076, 41862056992, 87857540836
Offset: 0

Views

Author

John Tyler Rascoe, Oct 18 2024

Keywords

Comments

By symmetry -a(n) is the sum of the nonpositive terms in the n-th row of A365968.

Examples

			The 4th row of A365968 is: [-10, -8, -6, -4, -4, -2, 0, 2, -2, 0, 2, 4, 4, 6, 8, 10], so a(4) = 2 + 2 + 4 + 4 + 6 + 8 + 10 = 36.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, s) option remember; `if`(n=0, s,
          b(n-1, abs(s-n))+b(n-1, s+n))
        end:
    a:= n-> b(n, 0)/2:
    seq(a(n), n=0..31);  # Alois P. Heinz, Jun 13 2025

Formula

a(n) = (1/2) * Sum_{k=0..2^n-1} abs(A365968(n,k)).
a(n) = (1/2) * Sum_{i=0..2^n-1} abs(A384868(i+2^n-1)). - Alois P. Heinz, Jun 13 2025
Showing 1-2 of 2 results.