The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation. Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A309952 XOR contraction of binary representation of n. 1
 0, 1, 1, 0, 2, 3, 3, 2, 2, 3, 3, 2, 0, 1, 1, 0, 4, 5, 5, 4, 6, 7, 7, 6, 6, 7, 7, 6, 4, 5, 5, 4, 4, 5, 5, 4, 6, 7, 7, 6, 6, 7, 7, 6, 4, 5, 5, 4, 0, 1, 1, 0, 2, 3, 3, 2, 2, 3, 3, 2, 0, 1, 1, 0, 8, 9, 9, 8, 10, 11, 11, 10, 10, 11, 11, 10, 8, 9, 9, 8, 12, 13, 13 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,5 COMMENTS To calculate a(n) write down the binary representation of n. Organize the digits in pairs and calculate the xor of these pairs. The result is a(n) in binary. Conjecture: The index of the first occurrence of k in a is A000695(k). - Ivan N. Ianakiev, Aug 26 2019 LINKS Alois P. Heinz, Table of n, a(n) for n = 0..16383 FORMULA a(n) = A292371(n) + A292372(n). - Rémy Sigrist, Aug 25 2019 a(0) = 0, a(4n) = 2*a(n), a(4n+1) = 2*a(n)+1, a(4n+2) = 2*a(n)+1, a(4n+3) = 2*a(n). - Florian Lang, Aug 26 2019 EXAMPLE For n=19 we have the binary representation 10011 = 01 00 11. Calculating the xor of the pairs gives 1 0 0 which is 4 in binary and therefore a(19) = 4. MAPLE a:= n-> `if`(n=0, 0, (r-> 2*a((n-r)/4) +r*(3-r)/2)(irem(n, 4))): seq(a(n), n=0..100);  # Alois P. Heinz, Aug 26 2019 PROG (Python) def a(n):     n = [int(k) for k in bin(n)[2:]]     if len(n) % 2 != 0:         n =  + n     result = []     for i in range(0, len(n), 2):         result.append(n[i] ^ n[i+1]) #xor     return int("".join([str(k) for k in result]), 2) (PARI) a(n) = {my(b = Vecrev(binary(n)), nb = #b\2, val = fromdigits(Vecrev(vector(nb, i, bitxor(b[2*i-1], b[2*i]))), 2)); if (#b % 2, val += 2^nb); val; } \\ Michel Marcus, Aug 26 2019 CROSSREFS Cf. A000695, A292371, A292372, A292373. Sequence in context: A096838 A096007 A269043 * A059252 A251619 A030620 Adjacent sequences:  A309949 A309950 A309951 * A309953 A309954 A309955 KEYWORD base,easy,look,nonn AUTHOR Florian Lang, Aug 24 2019 STATUS approved

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

Last modified June 14 08:31 EDT 2021. Contains 345018 sequences. (Running on oeis4.)