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-4 of 4 results.

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 -> ...

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).

A031466 Numbers whose base-4 representation has one fewer 0 than 3's.

Original entry on oeis.org

3, 7, 11, 13, 14, 23, 27, 29, 30, 39, 43, 45, 46, 51, 53, 54, 57, 58, 60, 79, 87, 91, 93, 94, 103, 107, 109, 110, 115, 117, 118, 121, 122, 124, 143, 151, 155, 157, 158, 167, 171, 173, 174, 179, 181, 182, 185, 186, 188, 199, 203, 205
Offset: 1

Views

Author

Keywords

Comments

Numbers n such that A160383(n) - A160380(n) = 1. - Robert Israel, Jun 05 2018

Crossrefs

Programs

  • Maple
    filter:= proc(n) local L;
      L:= convert(n,base,4);
      numboccur(3,L) - numboccur(0,L)=1
    end proc:
    select(filter, [$1..300]); # Robert Israel, Jun 05 2018
  • Mathematica
    Select[Range[210],DigitCount[#,4,0]==DigitCount[#,4,3]-1&] (* Harvey P. Dale, Dec 16 2011 *)

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

Showing 1-4 of 4 results.