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.

A037834 a(n) = Sum_{i=1..m} |d(i) - d(i-1)|, where Sum_{i=0..m} d(i)*2^i is the base-2 representation of n.

This page as a plain text file.
%I A037834 #40 May 11 2025 19:20:38
%S A037834 0,1,0,1,2,1,0,1,2,3,2,1,2,1,0,1,2,3,2,3,4,3,2,1,2,3,2,1,2,1,0,1,2,3,
%T A037834 2,3,4,3,2,3,4,5,4,3,4,3,2,1,2,3,2,3,4,3,2,1,2,3,2,1,2,1,0,1,2,3,2,3,
%U A037834 4,3,2,3,4,5,4,3,4,3,2,3,4,5,4,5,6,5,4,3,4,5
%N A037834 a(n) = Sum_{i=1..m} |d(i) - d(i-1)|, where Sum_{i=0..m} d(i)*2^i is the base-2 representation of n.
%C A037834 Number of i such that |d(i) - d(i-1)| = 1, where Sum_{i=0..m} d(i)*2^i is the base-2 representation of n.
%C A037834 a(n)+1 is the number of iterations of the map x -> A035327(x) needed to reach 0 (see A005811(n) for n>=1). - _Flávio V. Fernandes_, Apr 28 2025
%H A037834 Reinhard Zumkeller, <a href="/A037834/b037834.txt">Table of n, a(n) for n = 1..10000</a>
%H A037834 Paul Barry, <a href="https://arxiv.org/abs/2107.00442">Conjectures and results on some generalized Rueppel sequences</a>, arXiv:2107.00442 [math.CO], 2021.
%H A037834 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A037834 a(n) = A005811(n)-1.
%p A037834 A037834 := proc(n)
%p A037834     local dgs ;
%p A037834     dgs := convert(n,base,2);
%p A037834     add( abs(op(i,dgs)-op(i-1,dgs)),i=2..nops(dgs)) ;
%p A037834 end proc: # _R. J. Mathar_, Oct 16 2015
%t A037834 Table[Total@ Flatten@ Map[Abs@ Differences@ # &, Partition[ IntegerDigits[n, 2], 2, 1]], {n, 90}] (* _Michael De Vlieger_, May 09 2017 *)
%o A037834 (Haskell)
%o A037834 a037834 n = sum $ map fromEnum $ zipWith (/=) (tail bs) bs
%o A037834             where bs = a030308_row n
%o A037834 -- _Reinhard Zumkeller_, Feb 20 2014
%o A037834 (Python)
%o A037834 def A037834(n): return (n^(n>>1)).bit_count()-1 # _Chai Wah Wu_, Jul 13 2024
%Y A037834 Cf. A005811, A030308, A035327.
%K A037834 nonn,base
%O A037834 1,5
%A A037834 _Clark Kimberling_