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.

A292370 A binary encoding of the zeros in base-4 representation of n.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 2, 2, 2, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 2, 2, 2, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 2, 2, 2, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 7, 6, 6, 6, 5, 4, 4, 4, 5, 4, 4, 4, 5, 4, 4, 4, 3, 2, 2, 2, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 2, 2, 2, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 2, 2, 2, 1, 0, 0, 0, 1
Offset: 0

Views

Author

Antti Karttunen, Sep 15 2017

Keywords

Examples

			   n      a(n)     base-4(n)  binary(a(n))
                  A007090(n)  A007088(a(n))
  --      ----    ----------  ------------
   1        0          1           0
   2        0          2           0
   3        0          3           0
   4        1         10           1
   5        0         11           0
   6        0         12           0
   7        0         13           0
   8        1         20           1
   9        0         21           0
  10        0         22           0
  11        0         23           0
  12        1         30           1
  13        0         31           0
  14        0         32           0
  15        0         33           0
  16        3        100          11
  17        2        101          10
		

Crossrefs

Cf. A291770 (analogous sequence for base-3).

Programs

  • Mathematica
    Table[FromDigits[IntegerDigits[n, 4] /. k_ /; IntegerQ@ k :> If[k == 0, 1, 0], 2], {n, 0, 120}] (* Michael De Vlieger, Sep 21 2017 *)
  • Python
    from sympy.ntheory.factor_ import digits
    def a(n):
        k=digits(n, 4)[1:]
        return 0 if n==0 else int("".join('1' if i==0 else '0' for i in k), 2)
    print([a(n) for n in range(111)]) # Indranil Ghosh, Sep 21 2017
  • Scheme
    (define (A292370 n) (if (zero? n) n (let loop ((n n) (b 1) (s 0)) (if (< n 4) s (let ((d (modulo n 4))) (if (zero? d) (loop (/ n 4) (+ b b) (+ s b)) (loop (/ (- n d) 4) (+ b b) s)))))))
    

Formula

For all n >= 0, A000120(a(n)) = A160380(n).