login
A137305
Write n in base 3, change twos in ones and ones in twos, reverse.
1
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,2
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.
LINKS
FORMULA
a(3^n) = 2. a(2*3^n) = 1.
EXAMPLE
53 -> 1222 -> 2111 -> 1112 -> 41.
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 *)
CROSSREFS
Sequence in context: A334729 A221878 A219109 * A282885 A242841 A143208
KEYWORD
base,easy,nonn
AUTHOR
Jonathan Vos Post, Apr 20 2008
EXTENSIONS
Edited and corrected by Giovanni Resta, Jun 20 2016
STATUS
approved