The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A281497 Write n in binary reflected Gray code and sum the positions where there is a '1' followed immediately to the left by a '0', counting the rightmost digit as position 1. 2
0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 2, 2, 1, 0, 0, 1, 2, 2, 0, 0, 1, 0, 3, 4, 3, 3, 2, 2, 1, 0, 0, 1, 2, 2, 3, 3, 4, 3, 0, 1, 0, 0, 2, 2, 1, 0, 4, 5, 6, 6, 4, 4, 5, 4, 3, 4, 3, 3, 2, 2, 1, 0, 0, 1, 2, 2, 3, 3, 4, 3, 4, 5, 4, 4, 6, 6, 5, 4, 0, 1, 2, 2, 0, 0, 1, 0, 3, 4, 3, 3, 2, 2, 1, 0, 5, 6, 7, 7, 8, 8, 9, 8, 5, 6, 5, 5, 7, 7, 6 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,12
LINKS
FORMULA
a(n) = A049502(A003188(n)).
EXAMPLE
For n = 12, the binary reflected Gray code for 12 is '1010'. In '1010', the position of '1' followed immediately to the left by a '0' counting from right is 2. So, a(12) = 2.
MATHEMATICA
Table[If[Length@ # == 0, 0, Total[#[[All, 1]]]] &@ SequencePosition[ Reverse@ IntegerDigits[#, 2] &@ BitXor[n, Floor[n/2]], {1, 0}], {n, 120}] (* Michael De Vlieger, Jan 23 2017, Version 10.1, after Robert G. Wilson v at A003188 *)
PROG
(Python)
def G(n):
....return bin(n^(n/2))[2:]
def a(n):
....x=G(n)[::-1]
....s=0
....for i in range(1, len(x)):
........if x[i-1]=="1" and x[i]=="0":
............s+=i
....return s
CROSSREFS
Sequence in context: A353310 A347883 A024712 * A198243 A164965 A021823
KEYWORD
nonn,base
AUTHOR
Indranil Ghosh, Jan 23 2017
STATUS
approved

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 June 4 02:16 EDT 2024. Contains 373089 sequences. (Running on oeis4.)