login
A292370
A binary encoding of the zeros in base-4 representation of n.
5
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,17
FORMULA
For all n >= 0, A000120(a(n)) = A160380(n).
EXAMPLE
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
MATHEMATICA
Table[FromDigits[IntegerDigits[n, 4] /. k_ /; IntegerQ@ k :> If[k == 0, 1, 0], 2], {n, 0, 120}] (* Michael De Vlieger, Sep 21 2017 *)
PROG
(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)))))))
(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
CROSSREFS
Cf. A291770 (analogous sequence for base-3).
Sequence in context: A075801 A243160 A272694 * A116943 A328389 A332789
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Sep 15 2017
STATUS
approved