login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A103185 a(n) = Sum_{ k >= 0 such that n + k == 0 mod 2^k } 2^(k-1). 6

%I #21 Dec 07 2019 12:18:24

%S 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 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 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 a(n) = Sum_{ k >= 0 such that n + k == 0 mod 2^k } 2^(k-1).

%H Vincenzo Librandi, <a href="/A103185/b103185.txt">Table of n, a(n) for n = 0..2000</a>

%H 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 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 a(n) = (A102370(n) - n)/2.

%t 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 (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 (Python)

%o def a102370(n): return 0 if n<1 else sum([(n + k)&(2**k) for k in range(len(bin(n)[2:]) + 1)])

%o def a(n): return (a102370(n) - n)/2 # _Indranil Ghosh_, May 03 2017

%Y Cf. A102370(n).

%K nonn,easy,base

%O 0,3

%A _N. J. A. Sloane_, Mar 18 2005

%E More terms from _Robert G. Wilson v_, Mar 18 2005

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 04:42 EDT 2024. Contains 371964 sequences. (Running on oeis4.)