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.

User: Florian Lang

Florian Lang's wiki page.

Florian Lang has authored 2 sequences.

A333831 Dirichlet inverse of Mertens function (A002321).

Original entry on oeis.org

1, 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 4, 3, 2, 5, 2, 2, 4, 3, 7, 6, 1, 2, 8, 6, 1, 6, 5, 2, 9, 4, 8, 7, 2, 9, 13, 2, 1, 6, 10, 1, 10, 3, 7, 19, 2, 3, 16, 7, 7, 6, 8, 3, 14, 10, 14, 7, 0, 1, 31, 2, 1, 19, 8, 12, 7, 2, 6, 5, 14, 3, 35, 4, 3, 23, 9, 10, 11, 4, 24
Offset: 1

Author

Florian Lang, Apr 07 2020

Keywords

Crossrefs

Cf. A002321.

Programs

  • PARI
    seq(n)={dirdiv(vector(n, n, n==1), vector(n, n, sum(k=1, n, moebius(k))))} \\ Andrew Howroyd, Apr 07 2020

A309952 XOR contraction of binary representation of n.

Original entry on oeis.org

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
Offset: 0

Author

Florian Lang, Aug 24 2019

Keywords

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

Examples

			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.
		

Crossrefs

Programs

  • 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
  • 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
  • Python
    def a(n):
        n = [int(k) for k in bin(n)[2:]]
        if len(n) % 2 != 0:
            n = [0] + 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)
    
  • Python
    from itertools import zip_longest
    from operator import xor
    def A309952(n): return int(''.join(map(lambda x:str(xor(*x)),zip_longest((s:=tuple(int(d) for d in bin(n)[2:]))[::-2],s[-2::-2],fillvalue=0)))[::-1],2) # Chai Wah Wu, Jun 30 2022
    

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