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.

A103185 a(n) = Sum_{ k >= 0 such that n + k == 0 mod 2^k } 2^(k-1).

This page as a plain text file.
%I A103185 #21 Dec 07 2019 12:18:24
%S A103185 0,1,2,1,0,5,2,1,0,1,2,1,8,5,2,1,0,1,2,1,0,5,2,1,0,1,2,17,8,5,2,1,0,1,
%T A103185 2,1,0,5,2,1,0,1,2,1,8,5,2,1,0,1,2,1,0,5,2,1,0,1,34,17,8,5,2,1,0,1,2,
%U A103185 1,0,5,2,1,0,1,2,1,8,5,2,1,0,1,2,1,0,5,2,1,0,1,2,17,8,5,2,1,0,1,2,1,0,5,2,1
%N A103185 a(n) = Sum_{ k >= 0 such that n + k == 0 mod 2^k } 2^(k-1).
%H A103185 Vincenzo Librandi, <a href="/A103185/b103185.txt">Table of n, a(n) for n = 0..2000</a>
%H A103185 David Applegate, Benoit Cloitre, Philippe Deléham and N. J. A. Sloane, Sloping binary numbers: a new sequence related to the binary numbers [<a href="http://neilsloane.com/doc/slopey.pdf">pdf</a>, <a href="http://neilsloane.com/doc/slopey.ps">ps</a>].
%H A103185 David Applegate, Benoit Cloitre, Philippe Deléham and N. J. A. Sloane, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL8/Sloane/sloane300.html">Sloping binary numbers: a new sequence related to the binary numbers</a>, J. Integer Seq. 8 (2005), no. 3, Article 05.3.6, 15 pp.
%F A103185 a(n) = (A102370(n) - n)/2.
%t A103185 f[n_] := Block[{k = 1, s = 0, l = Max[2, Floor[ Log[2, n + 1] + 2]]}, While[k < l, If[ Mod[n + k, 2^k] == 0, s = s + 2^(k - 1)]; k++ ]; s]; Table[ f[n], {n, 0, 103}] (* _Robert G. Wilson v_, Mar 18 2005 *)
%o A103185 (PARI) A103185(n)=(sum(k=0,ceil(log(n+1)/log(2)),if((n+k)%2^k,0,2^k))-1)/2 \\ _Benoit Cloitre_, Mar 20 2005
%o A103185 (Python)
%o A103185 def a102370(n): return 0 if n<1 else sum([(n + k)&(2**k) for k in range(len(bin(n)[2:]) + 1)])
%o A103185 def a(n): return (a102370(n) - n)/2 # _Indranil Ghosh_, May 03 2017
%Y A103185 Cf. A102370(n).
%K A103185 nonn,easy,base
%O A103185 0,3
%A A103185 _N. J. A. Sloane_, Mar 18 2005
%E A103185 More terms from _Robert G. Wilson v_, Mar 18 2005