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

A036461 Number of 1 digits in base 3 representation of 2^n.

Original entry on oeis.org

1, 0, 2, 0, 2, 2, 2, 2, 4, 0, 4, 2, 4, 2, 6, 4, 2, 4, 6, 2, 6, 4, 6, 4, 8, 2, 10, 4, 4, 8, 6, 8, 8, 8, 8, 6, 10, 8, 10, 10, 6, 6, 12, 8, 10, 14, 8, 10, 10, 12, 16, 8, 12, 18, 10, 10, 14, 10, 14, 14, 16, 10, 16, 12, 16, 16, 14, 16, 14, 18, 20, 12, 20, 10, 22, 12, 26, 8, 20, 12, 22, 14, 16
Offset: 0

Views

Author

Keywords

Comments

The number of 1's in the base 3 representation of any even(odd) number is even(odd).

Crossrefs

Cf. A020915 (number of digits), A104320 (number of 0's), A260683 (number of 2's).

Programs

  • Maple
    seq(numboccur(1,convert(2^n,base,3)),n=0..100); # Robert Israel, Apr 04 2018
  • Mathematica
    Table[DigitCount[2^n,3,1],{n,0,120}]  (* Harvey P. Dale, Mar 14 2011 *)
  • PARI
    a(n) = #select(x->(x==1), digits(2^n, 3)); \\ Michel Marcus, Apr 04 2018

A265157 Number of 2's in the base-3 representation of 2^n - 1.

Original entry on oeis.org

0, 0, 0, 1, 1, 0, 1, 1, 0, 3, 2, 3, 3, 2, 2, 5, 5, 4, 3, 6, 4, 6, 5, 3, 1, 4, 2, 7, 8, 6, 9, 8, 8, 6, 7, 7, 4, 5, 8, 8, 11, 10, 7, 10, 10, 7, 9, 7, 8, 9, 11, 15, 13, 9, 9, 11, 13, 15, 12, 12, 15, 14, 11, 14, 16, 13, 14, 11, 14, 14, 14, 15
Offset: 0

Views

Author

L. Edson Jeffery, Dec 02 2015

Keywords

Crossrefs

Cf. A000079 (2^n), A000225 (2*n - 1).
Cf. A260683 (Number of 2's in the expansion of 2^n in base 3).

Programs

  • Mathematica
    n = -1; While[n < 71, n++; s = IntegerDigits[2^n - 1, 3]; k = Count[s, 2]; AppendTo[a, k]]; a (* after Emmanuel Vantieghem (see A260683)*)
    Table[DigitCount[2^n-1,3,2],{n,0,80}] (* Harvey P. Dale, Dec 04 2015 *)
  • PARI
    a(n) = {my(d = digits(n, 3)); sum(k=1, #d, d[k]==2);} \\ Michel Marcus, Dec 03 2015

Formula

a(n) = A081603(A000225(n)). - Michel Marcus, Dec 03 2015
a(n) = A260683(n) - A000035(n). - Robert Israel, Dec 03 2015
Showing 1-2 of 2 results.