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.

This page as a plain text file.
%I A383305 #13 Apr 25 2025 15:06:56
%S A383305 1,6,39,266,1730,11361,74809,494194,3273132,21730506,144588345,
%T A383305 964050593,6440655572,43111601819,289112380019,1942335481170,
%U A383305 13072051432742,88125501965430,595077180675348,4024698113281006,27261843502415806,184931926767687963,1256249015578188517,8545135121520262849,58198759816476208605
%N 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.
%t A383305 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]
%o A383305 (Python)
%o A383305 def A383305(n):
%o A383305     if n<=1: return n
%o A383305     s={(k,k,k):1 for k in range(1,10)}
%o A383305     for i in range(n-1):
%o A383305         snew={}
%o A383305         for (h,l,t),v in s.items():
%o A383305             for d in range(10):
%o A383305                 p=(max(h,d),min(l,d),t+d)
%o A383305                 if p in snew:
%o A383305                     snew[p]+=v
%o A383305                 else:
%o A383305                     snew[p]=v
%o A383305         s=snew
%o A383305     return sum( v for (h,l,t),v in s.items() if n*(h-l)==t) # _Bert Dobbelaere_, Apr 25 2025
%Y A383305 Cf. A037904, A054054, A054055, A371383, A371384, A383304.
%K A383305 nonn,base
%O A383305 1,2
%A A383305 _Stefano Spezia_, Apr 22 2025
%E A383305 More terms from _Bert Dobbelaere_, Apr 25 2025