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.

A103528 a(n) = Sum_{k = 1..n-1 such that n == k (mod 2^k)} 2^(k-1).

Original entry on oeis.org

0, 0, 1, 0, 1, 2, 1, 0, 1, 2, 5, 0, 1, 2, 1, 0, 1, 2, 5, 8, 1, 2, 1, 0, 1, 2, 5, 0, 1, 2, 1, 0, 1, 2, 5, 8, 17, 2, 1, 0, 1, 2, 5, 0, 1, 2, 1, 0, 1, 2, 5, 8, 1, 2, 1, 0, 1, 2, 5, 0, 1, 2, 1, 0, 1, 2, 5, 8, 17, 34, 1, 0, 1, 2, 5, 0, 1, 2, 1, 0, 1, 2, 5, 8, 1, 2, 1, 0, 1, 2, 5, 0, 1, 2, 1, 0, 1, 2, 5, 8
Offset: 1

Views

Author

N. J. A. Sloane, Mar 22 2005

Keywords

Comments

Is there a simpler closed form?

Crossrefs

Cf. A102371.

Programs

  • Maple
    f:=proc(n) local t1,k; t1:=0; for k from 1 to n-1 do if n mod 2^k = k then t1:=t1+2^(k-1); fi; od: t1; end;
  • Mathematica
    (* b = A102371 (using Alex Ratushnyak's code) *)
    b[n_] := b[n] = If[n == 1, 1, BitXor[b[n-1], b[n-1] + n]];
    a[n_] := (b[n] + n)/2 - 2^(n-1);
    Array[a, 100] (* Jean-François Alcover, Apr 11 2019, after Philippe Deléham *)
  • PARI
    a(n) = sum(k = 1, n-1, if ((n % 2^k) == k, 2^(k-1))); \\ Michel Marcus, May 06 2020

Formula

a(n) = (A102371(n) + n)/2 - 2^(n-1). - Philippe Deléham, Mar 27 2005
G.f.: Sum_{k>=1} 2^(k-1) x^(k+2^k)/(1 - x^(2^k)). - Robert Israel, Jan 21 2017
Conjecture: a(n) = (b(n) - b(n-1) - 1)/2 for n > 1 where b(n) = Sum_{k=0..A000523(n)} c(n-k, k) and c(n, m) = n - (n mod 2^m) with a(1) = 0. - Mikhail Kurkov, Jun 01 2022