|
|
A338830
|
|
a(n) is the greatest number not yet in the sequence with the same number of digits and the same largest digit as n.
|
|
2
|
|
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 10, 22, 33, 44, 55, 66, 77, 88, 99, 21, 20, 12, 32, 43, 54, 65, 76, 87, 98, 31, 30, 23, 13, 42, 53, 64, 75, 86, 97, 41, 40, 34, 24, 14, 52, 63, 74, 85, 96, 51, 50, 45, 35, 25, 15, 62, 73, 84, 95, 61, 60, 56, 46, 36, 26, 16, 72
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
This sequence is a self-inverse permutation of the nonnegative integers.
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
For n = 20:
- the numbers with 2 digits and largest digit 2 are: 12, 20, 21 and 22,
- so a(12) = 22,
a(20) = 21,
a(21) = 20,
a(22) = 12.
|
|
MATHEMATICA
|
Block[{a = {}, f, k}, f[x_] := Max@ IntegerDigits@ x; Do[k = f[i]; AppendTo[a, SelectFirst[Range[10^# - 1, 10^(# - 1), -1] &@ Floor[1 + Log10[i]], And[f[#] == k, FreeQ[a, #]] &]], {i, 67}]; a] (* Michael De Vlieger, Nov 13 2020 *)
|
|
PROG
|
(PARI) See Links section.
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|