%I #12 Oct 18 2021 01:38:47
%S 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,
%T 78,79,76,77,90,93,94,91,92,95,98,99,96,97,80,83,84,81,82,85,88,89,86,
%U 87,100,103,104,101,102,115,118,119,116,117,120,123,124,121
%N 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.
%C This sequence is a self-inverse permutation of the nonnegative integers.
%C It is possible to build a similar sequence for any fixed base b > 1 and any permutation p of {1, ..., b-1}.
%C This sequence is interesting as it satisfies f(a(n)) = -f(n), where f(n) = (A316657(n), A316658(n)).
%H Rémy Sigrist, <a href="/A348354/b348354.txt">Table of n, a(n) for n = 0..3124</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A316657(n) + A316657(a(n)) = 0.
%F A316658(n) + A316658(a(n)) = 0.
%e The first terms, in decimal and in base 5, are:
%e n a(n) q(n) q(a(n))
%e -- ---- ---- -------
%e 0 0 0 0
%e 1 3 1 3
%e 2 4 2 4
%e 3 1 3 1
%e 4 2 4 2
%e 5 15 10 30
%e 6 18 11 33
%e 7 19 12 34
%e 8 16 13 31
%e 9 17 14 32
%e 10 20 20 40
%t 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 *)
%o (PARI) a(n, p=[3,4,1,2]) = fromdigits(apply(d -> if (d, p[d], 0), digits(n, #p+1)), #p+1)
%Y See A004488, A048647 and A348355 for similar sequences.
%Y Cf. A316657, A316658.
%K nonn,base,easy
%O 0,2
%A _Rémy Sigrist_, Oct 14 2021