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.

A326300 Steinhaus sums.

Original entry on oeis.org

2, 6, 8, 16, 18, 22, 24, 40, 42, 46, 48, 56, 58, 62, 64, 96, 98, 102, 104, 112, 114, 118, 120, 136, 138, 142, 144, 152, 154, 158, 160, 224, 226, 230, 232, 240, 242, 246, 248, 264, 266, 270, 272, 280, 282, 286, 288, 320, 322, 326, 328, 336, 338, 342, 344, 360, 362, 366, 368
Offset: 1

Views

Author

Michel Marcus, Oct 17 2019

Keywords

Crossrefs

Cf. A000523 (log_2(n)), A006520.

Programs

  • PARI
    a(n) = sum(k=1, 1+log(n)\log(2), floor(n/2^k+1/2)*2^k);
    
  • Python
    def a(n):
        s = 0
        for k in range(1,n.bit_length()+1):
            s += ((n + (1 << (k-1))) >> k) << k
        return s
    print([a(n) for n in range(1,60)]) # Darío Clavijo, Aug 24 2024

Formula

a(n) = Sum_{k>=1} floor(n/2^k + 1/2)*2^k.
a(n) = 2 * A006520(n-1).