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.

Showing 1-6 of 6 results.

A292372 A binary encoding of 2-digits in base-4 representation of n.

Original entry on oeis.org

0, 0, 1, 0, 0, 0, 1, 0, 2, 2, 3, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 2, 3, 2, 0, 0, 1, 0, 4, 4, 5, 4, 4, 4, 5, 4, 6, 6, 7, 6, 4, 4, 5, 4, 0, 0, 1, 0, 0, 0, 1, 0, 2, 2, 3, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 2, 3, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 2, 3, 2, 0, 0, 1, 0, 4, 4, 5, 4, 4, 4, 5, 4, 6, 6, 7, 6, 4, 4, 5, 4, 0, 0, 1, 0, 0, 0, 1, 0, 2
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        1          2           1
   3        0          3           0
   4        0         10           0
   5        0         11           0
   6        1         12           1
   7        0         13           0
   8        2         20          10
   9        2         21          10
  10        3         22          11
  11        2         23          10
  12        0         30           0
  13        0         31           0
  14        1         32           1
  15        0         33           0
  16        0        100           0
  17        0        101           0
  18        1        102           1
		

Crossrefs

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

Programs

  • Mathematica
    Table[FromDigits[IntegerDigits[n, 4] /. k_ /; IntegerQ@ k :> If[k == 2, 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==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

Formula

a(n) = A059906(n AND A048724(n)), where AND is a bitwise-AND (A004198).
For all n >= 0, A000120(a(n)) = A160382(n).

A160383 Number of 3's in base-4 representation of n.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0
Offset: 0

Views

Author

Frank Ruskey, Jun 05 2009

Keywords

Crossrefs

Cf. A007090 (base 4), A160380 (0's), A160381 (1's), A160382 (2's).
Cf. A283316 (mod 2).

Programs

  • PARI
    a(n) = #select(x->(x==3), digits(n, 4)); \\ Michel Marcus, Mar 24 2020

Formula

Recurrence relation: a(0) = 0, a(4m+3) = 1+a(m), a(4m) = a(4m+1) = a(4m+2) = a(m).
G.f.: (1/(1-z))*Sum_{m>=0} (z^(3*4^m)*(1 - z^(4^m))/(1 - z^(4^(m+1)))).
Morphism: 0, j -> j,j,j,j+1; e.g., 0 -> 0001 -> 0001000100011112 -> ...

A329101 Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, the number of 1's in the base 4 expansion of n equals the number of 2's in the base 4 expansion of a(n).

Original entry on oeis.org

0, 2, 1, 3, 6, 10, 8, 9, 4, 11, 5, 7, 12, 14, 13, 15, 18, 26, 22, 24, 34, 42, 38, 40, 25, 41, 27, 30, 32, 43, 33, 35, 16, 36, 17, 19, 37, 46, 39, 44, 20, 45, 21, 23, 28, 47, 29, 31, 48, 50, 49, 51, 54, 58, 56, 57, 52, 59, 53, 55, 60, 62, 61, 63, 66, 74, 70, 72
Offset: 0

Views

Author

Rémy Sigrist, Nov 07 2019

Keywords

Comments

This sequence is a permutation of the nonnegative integers with inverse A329180.
Apparently, fixed points correspond to A001196.
The sequence has fractal features; for any k >= 0, the set of points { (n, a(n)), n = 0..4^k-1 } is symmetrical relative to the line of equation y + x = 4^k - 1 (see scatterplots in Links section).

Examples

			The first terms, alongside the base 4 representations of n and of a(n), are:
  n   a(n)  qua(n)  qua(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     2       1          2
   2     1       2          1
   3     3       3          3
   4     6      10         12
   5    10      11         22
   6     8      12         20
   7     9      13         21
   8     4      20         10
   9    11      21         23
  10     5      22         11
  11     7      23         13
  12    12      30         30
  13    14      31         32
  14    13      32         31
  15    15      33         33
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

A160381(n) = A160382(a(n)).

A039003 Numbers whose base-4 representation has the same number of 0's and 2's.

Original entry on oeis.org

1, 3, 5, 7, 8, 13, 15, 18, 21, 23, 24, 29, 31, 33, 35, 36, 44, 50, 53, 55, 56, 61, 63, 70, 73, 75, 78, 82, 85, 87, 88, 93, 95, 97, 99, 100, 108, 114, 117, 119, 120, 125, 127, 130, 133, 135, 136, 141, 143, 145, 147, 148, 156, 160, 177, 179, 180, 188, 198, 201, 203
Offset: 1

Views

Author

Keywords

Crossrefs

A039006 Numbers whose base-4 representation has the same number of 2's and 3's.

Original entry on oeis.org

0, 1, 4, 5, 11, 14, 16, 17, 20, 21, 27, 30, 35, 39, 44, 45, 50, 54, 56, 57, 64, 65, 68, 69, 75, 78, 80, 81, 84, 85, 91, 94, 99, 103, 108, 109, 114, 118, 120, 121, 131, 135, 140, 141, 147, 151, 156, 157, 175, 176, 177, 180, 181, 187, 190, 194, 198, 200, 201, 210
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A000302, A052539 (subsequences).

Programs

  • Mathematica
    Select[Range[0,250],DigitCount[#,4,2]==DigitCount[#,4,3]&] (* Harvey P. Dale, Mar 19 2017 *)

A338854 Product of the nonzero digits of (n written in base 4).

Original entry on oeis.org

1, 1, 2, 3, 1, 1, 2, 3, 2, 2, 4, 6, 3, 3, 6, 9, 1, 1, 2, 3, 1, 1, 2, 3, 2, 2, 4, 6, 3, 3, 6, 9, 2, 2, 4, 6, 2, 2, 4, 6, 4, 4, 8, 12, 6, 6, 12, 18, 3, 3, 6, 9, 3, 3, 6, 9, 6, 6, 12, 18, 9, 9, 18, 27, 1, 1, 2, 3, 1, 1, 2, 3, 2, 2, 4, 6, 3, 3, 6, 9, 1
Offset: 0

Views

Author

Ilya Gutkovskiy, Nov 12 2020

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Times @@ DeleteCases[IntegerDigits[n, 4], 0], {n, 0, 80}]
    nmax = 80; A[] = 1; Do[A[x] = (1 + x + 2 x^2 + 3 x^3) A[x^4] + O[x]^(nmax + 1) // Normal, nmax + 1]; CoefficientList[A[x], x]
  • PARI
    a(n) = vecprod(select(x->x, digits(n, 4))); \\ Michel Marcus, Nov 12 2020

Formula

G.f. A(x) satisfies: A(x) = (1 + x + 2*x^2 + 3*x^3) * A(x^4).
a(n) = 2^A160382(n) * 3^A160383(n).
Showing 1-6 of 6 results.