OFFSET
0,9
LINKS
FORMULA
EXAMPLE
MATHEMATICA
Table[FromDigits[IntegerDigits[n, 4] /. k_ /; IntegerQ@ k :> If[k == 2, 1, 0], 2], {n, 0, 120}] (* Michael De Vlieger, Sep 21 2017 *)
PROG
(Scheme, with memoization-macro definec)
(definec (A292372 n) (if (zero? n) n (let ((d (modulo n 4))) (+ (if (= 2 d) 1 0) (* 2 (A292372 (/ (- n d) 4)))))))
(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==2 else '0' for i in k), 2)
print([a(n) for n in range(121)]) # Indranil Ghosh, Sep 21 2017
(Python)
def A292372(n): return 0 if (m:=n&~(n<<1)) < 2 else int(bin(m)[-2:1:-2][::-1], 2) # Chai Wah Wu, Jun 30 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Sep 15 2017
STATUS
approved