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.

A357616 Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, the number of 1's in the ternary expansion of n equals the number of 2's in the ternary expansion of a(n) and vice versa.

Original entry on oeis.org

0, 2, 1, 6, 8, 5, 3, 7, 4, 18, 20, 11, 24, 26, 17, 15, 23, 14, 9, 19, 10, 21, 25, 16, 12, 22, 13, 54, 56, 29, 60, 62, 35, 33, 47, 32, 72, 74, 51, 78, 80, 53, 59, 71, 44, 45, 61, 34, 65, 77, 50, 38, 52, 41, 27, 55, 28, 57, 69, 42, 30, 46, 31, 63, 73, 48, 75, 79
Offset: 0

Views

Author

Rémy Sigrist, Oct 06 2022

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			The first terms, alongside their ternary expansions, are:
  n   a(n)  ter(n)  ter(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     2       1          2
   2     1       2          1
   3     6      10         20
   4     8      11         22
   5     5      12         12
   6     3      20         10
   7     7      21         21
   8     4      22         11
   9    18     100        200
  10    20     101        202
  11    11     102        102
  12    24     110        220
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

A081603(a(n)) = A062756(n).
A062756(a(n)) = A081603(n).
a(n) < 3^k iff n < 3^k.
a(n) = n iff n belongs to A039001.
Empirically:
- a(n) = n/2 iff n belongs to A005823,
- a(n) = 2*n iff n belongs to A005836.