cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 29, 49, 69, 89, 100, 101, 103, 104, 106, 107, 109, 119, 139, 149, 169, 179, 199, 299, 499, 599, 799, 899, 1000, 1002, 1004, 1006, 1008, 1019, 1039, 1059, 1079, 1099, 1299, 1499, 1699, 1899, 2999, 4999, 6999
Offset: 1

Views

Author

Rémy Sigrist, Sep 04 2024

Keywords

Comments

Equivalently, fixed points of A375968.
The sequence {A007953(a(n)) / A055642(a(n)), n > 0} runs uniquely through every rational number between 0 and 9.

Examples

			The first terms, alongside the corresponding digit average, are:
  n   a(n)  Digit average
  --  ----  -------------
   1     0              0
   2     1              1
   3     2              2
   4     3              3
   5     4              4
   6     5              5
   7     6              6
   8     7              7
   9     8              8
  10     9              9
  11    10            1/2
  12    12            3/2
  13    14            5/2
  14    16            7/2
  15    18            9/2
		

Crossrefs

Programs

  • Mathematica
    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 *)
  • PARI
    avg(n, base = 10) = { my (d = digits(n, base)); vecsum(d) / max(1, #d) }
    { V = Map(); k = 0; for (n = 0, 6999, v = avg(n); if (!mapisdefined(V, v), mapput(V, v, n); print1 (n", "););); }
    
  • PARI
    \\ See Links section.
    
  • Python
    from math import gcd
    from itertools import count, islice
    def agen():
        m = 0
        yield 0
        for w in count(1): # w = number of digits
            for s in range(1, 9*w+1): # s = sum of digits
                if gcd(s, w) == 1:
                    d, r = [1] + [0 for _ in range(w-1)], s-1
                    for k in range(w-1, -1, -1):
                        d[k], r = d[k] + min(r, 9), r - min(r, 9)
                    yield int("".join(map(str, d)))
    print(list(islice(agen(), 54)))
    # Michael S. Branicky, Sep 08 2024 after Rémy Sigrist PARI in link