login
Lexicographically latest sequence of distinct nonnegative integers such that the multisets of frequencies of digits in the decimal representations of n and of a(n) are the same.
2

%I #12 Mar 01 2021 02:12:17

%S 0,9,8,7,6,5,4,3,2,1,98,99,97,96,95,94,93,92,91,90,89,87,88,86,85,84,

%T 83,82,81,80,79,78,76,77,75,74,73,72,71,70,69,68,67,65,66,64,63,62,61,

%U 60,59,58,57,56,54,55,53,52,51,50,49,48,47,46,45,43,44,42

%N Lexicographically latest sequence of distinct nonnegative integers such that the multisets of frequencies of digits in the decimal representations of n and of a(n) are the same.

%C We ignore leading zeros (hence a(0) = 0).

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

%H Rémy Sigrist, <a href="/A342115/b342115.txt">Table of n, a(n) for n = 0..9999</a>

%H Rémy Sigrist, <a href="/A342115/a342115.gp.txt">PARI program for A342115</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F a(d * (10^k-1)/9) = (10-d) * (10^k-1)/9 for any k >= 0 and d = 1..9.

%F a(n) < 10^k for any n < 10^k.

%e Consider the set of numbers T with two distinct digits, say u and v, such that u appears once and v appears twice:

%e - the least elements of T are: 100, 101, 110, 112,

%e - the greatest elements of T are: 995, 996, 997, 998,

%e - so a(100) = 998, a(101) = 997, a(110) = 996, a(112) = 995.

%o (PARI) See Links section.

%Y See A342102 for similar sequences.

%Y Cf. A055641, A268643, A316863, A316864, A316865, A316866, A316867, A316868, A316869, A102683.

%K nonn,base

%O 0,2

%A _Rémy Sigrist_, Feb 28 2021