login
A379181
a(n) is the number of n-digit nonnegative integers with mode and mean of the digits equal.
2
10, 9, 9, 237, 1617, 15099, 98490, 855675, 7020429, 68359815, 638064114, 6014495595, 55556308754, 504305784381, 4627364658702, 42696037939075, 402860074430853, 3847842858816523, 36989026236202050, 355682935667617515, 3396760984948340678, 32234267063991934093
OFFSET
1,1
LINKS
FORMULA
Conjecture: a(n+1)/a(n) ~ 10. - Stefano Spezia, Jul 23 2025
MATHEMATICA
a[n_]:=Module[{c=KroneckerDelta[n, 1]}, For[k=10^(n-1), k<=10^n-1, k++, If[Commonest[IntegerDigits[k]]=={Mean[IntegerDigits[k]]}, c++]]; c]; Array[a, 6]
PROG
(Python)
from math import factorial, prod
from collections import Counter
from sympy.utilities.iterables import partitions
def A379181(n):
if n == 1: return 10
c, f = 0, factorial(n-1)
for k in range(1, 10):
for s, p in partitions(k*n, m=n, k=9, size=True):
v = list(p.values())
if n-s>0: p[0]=n-s
r = Counter(p).most_common(2)
if r[0][0]==k and (len(r)==1 or r[1][1]<r[0][1]):
w = prod((factorial(i) for i in v))*factorial(n-s)
c += sum(f*i//w for i in v)
return c # Chai Wah Wu, Dec 21 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Stefano Spezia, Dec 17 2024
EXTENSIONS
a(11)-a(22) from Chai Wah Wu, Dec 21 2024
STATUS
approved