OFFSET
1,1
COMMENTS
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
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