login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A348354
The base-5 expansion of a(n) is obtained by replacing 1's, 2's, 3's and 4's by 3's, 4's, 1's and 2's, respectively, in the base-5 expansion of n.
2
0, 3, 4, 1, 2, 15, 18, 19, 16, 17, 20, 23, 24, 21, 22, 5, 8, 9, 6, 7, 10, 13, 14, 11, 12, 75, 78, 79, 76, 77, 90, 93, 94, 91, 92, 95, 98, 99, 96, 97, 80, 83, 84, 81, 82, 85, 88, 89, 86, 87, 100, 103, 104, 101, 102, 115, 118, 119, 116, 117, 120, 123, 124, 121
OFFSET
0,2
COMMENTS
This sequence is a self-inverse permutation of the nonnegative integers.
It is possible to build a similar sequence for any fixed base b > 1 and any permutation p of {1, ..., b-1}.
This sequence is interesting as it satisfies f(a(n)) = -f(n), where f(n) = (A316657(n), A316658(n)).
FORMULA
A316657(n) + A316657(a(n)) = 0.
A316658(n) + A316658(a(n)) = 0.
EXAMPLE
The first terms, in decimal and in base 5, are:
n a(n) q(n) q(a(n))
-- ---- ---- -------
0 0 0 0
1 3 1 3
2 4 2 4
3 1 3 1
4 2 4 2
5 15 10 30
6 18 11 33
7 19 12 34
8 16 13 31
9 17 14 32
10 20 20 40
MATHEMATICA
a[n_] := With[{d = {0, 3, 4, 1, 2}}, FromDigits[d[[IntegerDigits[n, 5] + 1]], 5]]; Array[a, 64, 0] (* Amiram Eldar, Oct 16 2021 *)
PROG
(PARI) a(n, p=[3, 4, 1, 2]) = fromdigits(apply(d -> if (d, p[d], 0), digits(n, #p+1)), #p+1)
CROSSREFS
See A004488, A048647 and A348355 for similar sequences.
Sequence in context: A171073 A021297 A124909 * A356708 A281098 A090279
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Oct 14 2021
STATUS
approved