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.

A383305 a(n) is number of n-digit nonnegative integers whose difference between the largest and smallest digits is equal to the arithmetic mean of its digits.

Original entry on oeis.org

1, 6, 39, 266, 1730, 11361, 74809, 494194, 3273132, 21730506, 144588345, 964050593, 6440655572, 43111601819, 289112380019, 1942335481170, 13072051432742, 88125501965430, 595077180675348, 4024698113281006, 27261843502415806, 184931926767687963, 1256249015578188517, 8545135121520262849, 58198759816476208605
Offset: 1

Views

Author

Stefano Spezia, Apr 22 2025

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_]:=Module[{c=KroneckerDelta[n,1]}, For[k=10^(n-1), k<=10^n, k++, If[Max[d=IntegerDigits[k]]-Min[d]==Mean[d], c++]]; c]; Array[a,7]
  • Python
    def A383305(n):
        if n<=1: return n
        s={(k,k,k):1 for k in range(1,10)}
        for i in range(n-1):
            snew={}
            for (h,l,t),v in s.items():
                for d in range(10):
                    p=(max(h,d),min(l,d),t+d)
                    if p in snew:
                        snew[p]+=v
                    else:
                        snew[p]=v
            s=snew
        return sum( v for (h,l,t),v in s.items() if n*(h-l)==t) # Bert Dobbelaere, Apr 25 2025

Extensions

More terms from Bert Dobbelaere, Apr 25 2025