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.

A372783 In the ternary expansion of n: keep the initial digit, and then replace 0's with 1's and 1's with 0's.

Original entry on oeis.org

0, 1, 2, 4, 3, 5, 7, 6, 8, 13, 12, 14, 10, 9, 11, 16, 15, 17, 22, 21, 23, 19, 18, 20, 25, 24, 26, 40, 39, 41, 37, 36, 38, 43, 42, 44, 31, 30, 32, 28, 27, 29, 34, 33, 35, 49, 48, 50, 46, 45, 47, 52, 51, 53, 67, 66, 68, 64, 63, 65, 70, 69, 71, 58, 57, 59, 55, 54
Offset: 0

Views

Author

Rémy Sigrist, May 13 2024

Keywords

Comments

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

Examples

			For n = 42: the ternary expansion of 42 is "1120", so the ternary expansion of a(42) is "1021", and a(42) = 34.
		

Crossrefs

Cf. A004488, A062318 (fixed points), A115303.

Programs

  • Mathematica
    Table[t3=IntegerDigits[n,3];fd=First[t3];tr=Rest[t3]/.{1->0,0->1};PrependTo[tr,fd];FromDigits[tr,3],{n,0,67}] (* James C. McMahon, May 31 2024 *)
  • PARI
    a(n) = { my (t = digits(n, 3)); for (i = 2, #t, t[i] = [1,0,2][1+t[i]];); fromdigits(t, 3); }

Formula

a(n) = n iff n belongs to A062318.