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.

Original entry on oeis.org

10, 1, 131, 474, 10233, 50844, 1001250, 5225775, 99980565, 536333508, 9998984322, 55188464010, 999994914558, 5683515922236, 100001648752524, 585428890525092, 10000105972653645, 60302140270087340, 1000004027662440330, 6207976859006478708, 100000111315410065850
Offset: 1

Views

Author

Stefano Spezia, Dec 09 2024

Keywords

Crossrefs

Programs

  • Mathematica
    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]
  • Python
    from math import prod, factorial
    from collections import Counter
    from sympy.utilities.iterables import partitions
    def A378836(n):
        if n==1: return 10
        c, f = 0, factorial(n-1)
        for i in range(1,9*n+1):
            for s,p in partitions(i,m=n,k=9,size=True):
                a = sorted(list(Counter(p).elements())+[0]*(n-s))
                b = a[len(a)-1>>1]+a[len(a)>>1]
                if b&1^1 and b>>1 == 1+(i-1)%9:
                    v = list(p.values())
                    p = prod((factorial(i) for i in v))*factorial(n-s)
                    c += sum(f*i//p for i in v)
        return c # Chai Wah Wu, Dec 12 2024

Extensions

a(11)-a(21) from Chai Wah Wu, Dec 12 2024