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!)
A372358 a(n) = n XOR A086893(1+A000523(n)), where XOR is a bitwise-XOR, A003987. 6
0, 1, 0, 1, 0, 3, 2, 5, 4, 7, 6, 1, 0, 3, 2, 5, 4, 7, 6, 1, 0, 3, 2, 13, 12, 15, 14, 9, 8, 11, 10, 21, 20, 23, 22, 17, 16, 19, 18, 29, 28, 31, 30, 25, 24, 27, 26, 5, 4, 7, 6, 1, 0, 3, 2, 13, 12, 15, 14, 9, 8, 11, 10, 21, 20, 23, 22, 17, 16, 19, 18, 29, 28, 31, 30, 25, 24, 27, 26, 5, 4, 7, 6, 1, 0, 3, 2, 13, 12, 15 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,6
COMMENTS
a(n) gives n xored with the unique term of A086893 that has the same binary length as n itself. The binary expansions of the terms of A086893 are of the form 10101...0101 (i.e., alternating 1's and 0's starting and ending with 1) when the binary length is odd, and of the form 110101...0101 (i.e., 1 followed by alternating 1's and 0's, and ending with 1) when the binary length is even. In other words, a(n) is n with its all its even-positioned bits (indexing starts from 0 which stands for the least significant bit) inverted, and additionally also the odd-positioned most significant bit inverted if the number of significant bits is even (i.e., n is a nonzero term of A053754).
LINKS
EXAMPLE
25 in binary is 11001_2, and inverting all the even-positioned bits gives 01100_2, and as A007088(12) = 1100, a(25) = 12.
46 in binary is 101110_2, so we flip all the even-positioned bits (starting from the rightmost, with position 0), and because there are even number of bits in the binary expansion, we flip also the most significant bit, thus we obtain 011011_2, and as A007088(27) = 11011, a(46) = 27.
PROG
(PARI)
A000523(n) = logint(n, 2);
A086893(n) = (if(n%2, 2^(n+1), 2^(n+1)+2^(n-1))\3); \\ From A086893
A372358(n) = bitxor(n, A086893(1+A000523(n)));
CROSSREFS
Sequence in context: A191736 A372654 A297208 * A301941 A344547 A135762
KEYWORD
nonn,base,easy
AUTHOR
Antti Karttunen, May 01 2024
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 May 20 08:05 EDT 2024. Contains 372703 sequences. (Running on oeis4.)