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.

A378836 a(n) is the number of n-digit nonnegative integers with the median of the digits equal to the digital root.

This page as a plain text file.
%I A378836 #23 Dec 16 2024 02:07:04
%S A378836 10,1,131,474,10233,50844,1001250,5225775,99980565,536333508,
%T A378836 9998984322,55188464010,999994914558,5683515922236,100001648752524,
%U A378836 585428890525092,10000105972653645,60302140270087340,1000004027662440330,6207976859006478708,100000111315410065850
%N A378836 a(n) is the number of n-digit nonnegative integers with the median of the digits equal to the digital root.
%H A378836 Chai Wah Wu, <a href="/A378836/b378836.txt">Table of n, a(n) for n = 1..43</a>
%t A378836 A010888[n_]:=If[n==0,0,n - 9*Floor[(n-1)/9]]; a[n_]:=If[n==1,10,Module[{c=0}, For[k=10^(n-1), k<=10^n-1, k++, If[Median[IntegerDigits[k]]==A010888[k], c++]]; c]]; Array[a, 6]
%o A378836 (Python)
%o A378836 from math import prod, factorial
%o A378836 from collections import Counter
%o A378836 from sympy.utilities.iterables import partitions
%o A378836 def A378836(n):
%o A378836     if n==1: return 10
%o A378836     c, f = 0, factorial(n-1)
%o A378836     for i in range(1,9*n+1):
%o A378836         for s,p in partitions(i,m=n,k=9,size=True):
%o A378836             a = sorted(list(Counter(p).elements())+[0]*(n-s))
%o A378836             b = a[len(a)-1>>1]+a[len(a)>>1]
%o A378836             if b&1^1 and b>>1 == 1+(i-1)%9:
%o A378836                 v = list(p.values())
%o A378836                 p = prod((factorial(i) for i in v))*factorial(n-s)
%o A378836                 c += sum(f*i//p for i in v)
%o A378836     return c # _Chai Wah Wu_, Dec 12 2024
%Y A378836 Cf. A010888, A378835.
%Y A378836 Cf. A378560, A378564, A378837, A378838.
%K A378836 nonn,base
%O A378836 1,1
%A A378836 _Stefano Spezia_, Dec 09 2024
%E A378836 a(11)-a(21) from _Chai Wah Wu_, Dec 12 2024