login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Lexicographically earliest sequence of nonnegative integers with distinct digit averages.
2

%I #16 Sep 08 2024 21:41:10

%S 0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,29,49,69,89,100,101,103,104,106,

%T 107,109,119,139,149,169,179,199,299,499,599,799,899,1000,1002,1004,

%U 1006,1008,1019,1039,1059,1079,1099,1299,1499,1699,1899,2999,4999,6999

%N Lexicographically earliest sequence of nonnegative integers with distinct digit averages.

%C Equivalently, fixed points of A375968.

%C The sequence {A007953(a(n)) / A055642(a(n)), n > 0} runs uniquely through every rational number between 0 and 9.

%H Rémy Sigrist, <a href="/A375969/b375969.txt">Table of n, a(n) for n = 1..10459</a>

%H Rémy Sigrist, <a href="/A375969/a375969.gp.txt">PARI program</a>

%e The first terms, alongside the corresponding digit average, are:

%e n a(n) Digit average

%e -- ---- -------------

%e 1 0 0

%e 2 1 1

%e 3 2 2

%e 4 3 3

%e 5 4 4

%e 6 5 5

%e 7 6 6

%e 8 7 7

%e 9 8 8

%e 10 9 9

%e 11 10 1/2

%e 12 12 3/2

%e 13 14 5/2

%e 14 16 7/2

%e 15 18 9/2

%t kmax=7000; avg={}; list={}; For[k=0, k<=kmax, k++,mn=Mean[IntegerDigits[k]]; If[!MemberQ[avg,mn], AppendTo[avg, mn]; AppendTo[list, k]]]; list (* _Stefano Spezia_, Sep 07 2024 *)

%o (PARI) avg(n, base = 10) = { my (d = digits(n, base)); vecsum(d) / max(1, #d) }

%o { V = Map(); k = 0; for (n = 0, 6999, v = avg(n); if (!mapisdefined(V, v), mapput(V, v, n); print1 (n", "););); }

%o (PARI) \\ See Links section.

%o (Python)

%o from math import gcd

%o from itertools import count, islice

%o def agen():

%o m = 0

%o yield 0

%o for w in count(1): # w = number of digits

%o for s in range(1, 9*w+1): # s = sum of digits

%o if gcd(s, w) == 1:

%o d, r = [1] + [0 for _ in range(w-1)], s-1

%o for k in range(w-1, -1, -1):

%o d[k], r = d[k] + min(r, 9), r - min(r, 9)

%o yield int("".join(map(str, d)))

%o print(list(islice(agen(), 54)))

%o # _Michael S. Branicky_, Sep 08 2024 after _Rémy Sigrist_ PARI in link

%Y Cf. A007953, A051885, A055642, A375968.

%K nonn,base

%O 1,3

%A _Rémy Sigrist_, Sep 04 2024