login
A375967
a(n) is the least number > n with the same digit average as n.
2
11, 13, 15, 17, 19, 39, 59, 79, 99, 1001, 20, 21, 22, 23, 24, 25, 26, 27, 28, 102, 30, 31, 32, 33, 34, 35, 36, 37, 38, 1005, 40, 41, 42, 43, 44, 45, 46, 47, 48, 105, 50, 51, 52, 53, 54, 55, 56, 57, 58, 1009, 60, 61, 62, 63, 64, 65, 66, 67, 68, 108, 70, 71, 72
OFFSET
1,1
COMMENTS
The digit average of a number n is its sum of digits divided by its number of digits: A007953(n) / A055642(n).
LINKS
Rémy Sigrist, PARI program
EXAMPLE
The first terms, alongside the corresponding digit average, are:
n a(n) Digit average
-- ---- -------------
1 11 1
2 13 2
3 15 3
4 17 4
5 19 5
6 39 6
7 59 7
8 79 8
9 99 9
10 1001 1/2
11 20 1
12 21 3/2
MATHEMATICA
a[n_]:=Module[{k=0}, While[k<=n || Mean[IntegerDigits[k]] != Mean[IntegerDigits[n]], k++]; k]; Array[a, 63] (* Stefano Spezia, Sep 07 2024 *)
PROG
(PARI) avg(n, base) = my (d = digits(n, base)); vecsum(d) / max(1, #d)
a(n, base = 10) = { my (v = avg(n, base)); for (m = n+1, oo, if (avg(m, base)==v, return (m); ); ); }
(PARI) \\ See Links section.
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Sep 04 2024
STATUS
approved