login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A361945 If the ternary expansion of n starts with the digit 1, then replace 2's by 0's and vice versa; if the ternary expansion of n starts with the digit 2, then replace 1's by 0's and vice versa; a(0) = 0. 4
0, 1, 2, 5, 4, 3, 7, 6, 8, 17, 16, 15, 14, 13, 12, 11, 10, 9, 22, 21, 23, 19, 18, 20, 25, 24, 26, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 67, 66, 68, 64, 63, 65, 70, 69, 71, 58, 57, 59, 55, 54 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Leading zeros in ternary expansions are ignored.
This sequence is a self-inverse permutation of the nonnegative integers.
LINKS
FORMULA
a(n) = n iff n belongs to A048328.
a(n) = A171960(n) when A122586(n) = 1.
EXAMPLE
The first terms, in decimal and in ternary, are:
n a(n) ter(n) ter(a(n))
-- ---- ------ ---------
0 0 0 0
1 1 1 1
2 2 2 2
3 5 10 12
4 4 11 11
5 3 12 10
6 7 20 21
7 6 21 20
8 8 22 22
9 17 100 122
10 16 101 121
11 15 102 120
12 14 110 112
13 13 111 111
14 12 112 110
15 11 120 102
PROG
(PARI) a(n) = { my (d = digits(n, 3), m); if (#d==0, m = [0, 1, 2], d[1]==1, m = [2, 1, 0], m = [1, 0, 2]); fromdigits(apply(t -> m[1+t], d), 3); }
CROSSREFS
Cf. A048328 (fixed points), A122586, A171960.
Sequence in context: A265357 A265358 A361832 * A171837 A216253 A115303
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Mar 31 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 24 17:23 EDT 2024. Contains 375417 sequences. (Running on oeis4.)