OFFSET
0,1
COMMENTS
In a certain country, digits come in sealed boxes containing 10 distinct digits each. To write the number 2019 you can open a single box and extract the digits 2, 0, 1, and 9.
We call the "imbalance" of 2019 the number of unused digit in the opened box(es). So writing 2019 leaves an imbalance of 6 (the 6 unused digits in the box).
If we want to write 2020 we must open two boxes - and leave behind 8 digits in the first box and 8 digits in the second one. This produces for 2020 an imbalance of 16.
LINKS
Scott R. Shannon, Table of n, a(n) for n = 1..10000
Eric Angelini, Integer + imbalance, Feb 20 2020.
EXAMPLE
10 has an imbalance of 8 - there are two unused digits in the box. For 11 we have to open two boxes to get the two 1's, leaving an imbalance of 9+9 = 18.
MATHEMATICA
Array[10*Max@ #2[[All, -1]] - Length@ #1 & @@ {#, Tally@ #} &@ IntegerDigits@ # &, 101, 0] (* Michael De Vlieger, Feb 21 2020 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Feb 21 2020, based on a message from Eric Angelini, Feb 20 2020
STATUS
approved