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.

A292371 A binary encoding of 1-digits in the base-4 representation of n.

This page as a plain text file.
%I A292371 #41 Jun 30 2022 14:43:59
%S A292371 0,1,0,0,2,3,2,2,0,1,0,0,0,1,0,0,4,5,4,4,6,7,6,6,4,5,4,4,4,5,4,4,0,1,
%T A292371 0,0,2,3,2,2,0,1,0,0,0,1,0,0,0,1,0,0,2,3,2,2,0,1,0,0,0,1,0,0,8,9,8,8,
%U A292371 10,11,10,10,8,9,8,8,8,9,8,8,12,13,12,12,14,15,14,14,12,13,12,12,12,13,12,12,8,9,8,8,10,11,10,10,8,9,8,8,8,9,8,8,8
%N A292371 A binary encoding of 1-digits in the base-4 representation of n.
%H A292371 Antti Karttunen, <a href="/A292371/b292371.txt">Table of n, a(n) for n = 0..65536</a>
%H A292371 Rémy Sigrist, <a href="https://practical-ardinghelli-959d8f.netlify.app/a292371">Interactive scatterplot of (a(n), A292372(n), A292373(n)) for n=0..4^8-1</a> [provided your web browser supports the Plotly library, you should see icons on the top right corner of the page:  if you choose "Orbital rotation", then you will be able to rotate the plot alongside three axes, the 3D plot here corresponds to a Sierpiński triangle-based pyramid]
%H A292371 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A292371 a(n) = A059905(A292272(n)) = A059905(n AND A003188(n)), where AND is bitwise-AND (A004198).
%F A292371 For all n >= 0, A000120(a(n)) = A160381(n).
%e A292371    n      a(n)     base-4(n)  binary(a(n))
%e A292371                   A007090(n)  A007088(a(n))
%e A292371   --      ----    ----------  ------------
%e A292371    1        1          1           1
%e A292371    2        0          2           0
%e A292371    3        0          3           0
%e A292371    4        2         10          10
%e A292371    5        3         11          11
%e A292371    6        2         12          10
%e A292371    7        2         13          10
%e A292371    8        0         20           0
%e A292371    9        1         21           1
%e A292371   10        0         22           0
%e A292371   11        0         23           0
%e A292371   12        0         30           0
%e A292371   13        1         31           1
%e A292371   14        0         32           0
%e A292371   15        0         33           0
%e A292371   16        4        100         100
%e A292371   17        5        101         101
%e A292371   18        4        102         100
%t A292371 Table[FromDigits[IntegerDigits[n, 4] /. k_ /; IntegerQ@ k :> If[k == 1, 1, 0], 2], {n, 0, 112}] (* _Michael De Vlieger_, Sep 21 2017 *)
%o A292371 (Scheme, with memoization-macro definec)
%o A292371 (definec (A292371 n) (if (zero? n) n (let ((d (modulo n 4))) (+ (if (= 1 d) 1 0) (* 2 (A292371 (/ (- n d) 4)))))))
%o A292371 (Python)
%o A292371 from sympy.ntheory.factor_ import digits
%o A292371 def a(n):
%o A292371     k=digits(n, 4)[1:]
%o A292371     return 0 if n==0 else int("".join('1' if i==1 else '0' for i in k), 2)
%o A292371 print([a(n) for n in range(116)]) # _Indranil Ghosh_, Sep 21 2017
%o A292371 (Python)
%o A292371 def A292371(n): return int(bin(n&~(n>>1))[:1:-2][::-1],2) # _Chai Wah Wu_, Jun 30 2022
%Y A292371 Cf. A003188, A004198, A007088, A007090, A059905, A160381, A292272, A292370, A292372, A292373.
%Y A292371 Cf. A289813 (analogous sequence for base 3).
%K A292371 nonn,base
%O A292371 0,5
%A A292371 _Antti Karttunen_, Sep 15 2017