A325984 Lexicographically earliest sequence of distinct nonnegative terms such that for any n >= 0, the sum of digits of n in base 2 equals the sum of digits of a(n) in base 3.
0, 1, 3, 2, 9, 4, 6, 5, 27, 10, 12, 7, 18, 11, 13, 8, 81, 28, 30, 15, 36, 19, 21, 14, 54, 29, 31, 16, 33, 20, 22, 17, 243, 82, 84, 37, 90, 39, 45, 24, 108, 55, 57, 32, 63, 34, 38, 23, 162, 83, 85, 40, 87, 42, 46, 25, 91, 48, 56, 35, 58, 41, 43, 26, 729, 244
Offset: 0
Examples
The first terms, alongside the binary representation of n and the ternary representation of a(n), are: n a(n) bin(n) ter(a(n)) -- ---- ------ --------- 0 0 0 0 1 1 1 1 2 3 10 10 3 2 11 2 4 9 100 100 5 4 101 11 6 6 110 20 7 5 111 12 8 27 1000 1000 9 10 1001 101 10 12 1010 110 11 7 1011 21 12 18 1100 200 13 11 1101 102 14 13 1110 111 15 8 1111 22 16 81 10000 10000
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..8192
- Rémy Sigrist, Colored logarithmic scatterplot of the sequence for n = 0..2^16 (where the color is function of A000120(n)).
- Rémy Sigrist, PARI program for A325984.
- Index entries for sequences that are permutations of the natural numbers.
Programs
-
Mathematica
a[0] = 0; a[n_] := a[n] = Module[{s = DigitCount[n, 2, 1], k = 1}, While[! FreeQ[Array[a, n - 1], k] || Plus @@ IntegerDigits[k, 3] != s, k++]; k]; Array[a, 66, 0] (* Amiram Eldar, Jul 25 2023 *)
-
PARI
See Links section.
Comments