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.

A137305 Write n in base 3, change twos in ones and ones in twos, reverse.

Original entry on oeis.org

0, 2, 1, 2, 8, 5, 1, 7, 4, 2, 20, 11, 8, 26, 17, 5, 23, 14, 1, 19, 10, 7, 25, 16, 4, 22, 13, 2, 56, 29, 20, 74, 47, 11, 65, 38, 8, 62, 35, 26, 80, 53, 17, 71, 44, 5, 59, 32, 23, 77, 50, 14, 68, 41, 1, 55, 28, 19, 73, 46, 10
Offset: 0

Views

Author

Jonathan Vos Post, Apr 20 2008

Keywords

Comments

This is not to A036044 as A007089 is to A007088: despite similarity here the operation performed is not a base 3 complement. Fixed points begin: 5, 7, 11, 19, 29, 44, 50, 55.

Examples

			53 -> 1222 -> 2111 -> 1112 -> 41.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) local m, r; m, r:= n, 0; while m>0
          do r:=r*3+[0, 2, 1][1+irem(m, 3, 'm')] od; r
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Jun 20 2016
  • Mathematica
    a[n_] := FromDigits[ Reverse[ IntegerDigits[n, 3] /. {1 -> 2, 2 -> 1}], 3] (* Giovanni Resta, Jun 20 2016 *)

Formula

a(3^n) = 2. a(2*3^n) = 1.

Extensions

Edited and corrected by Giovanni Resta, Jun 20 2016