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.

Showing 1-2 of 2 results.

A353182 Number of n-digit numbers in which more than half of the digits are the same.

Original entry on oeis.org

9, 9, 252, 333, 7704, 11430, 245520, 388485, 8018280, 13221234, 266135472, 451623042, 8935693776, 15488764524, 302623991712, 533189070405, 10317992397480, 18416195186490, 353689409441520, 637974569854998, 12177584747670384, 22158431087271444, 420819143651579232, 771390571080374658
Offset: 1

Views

Author

Zhining Yang, Apr 29 2022

Keywords

Comments

a(n) is the number of terms between 10^(n-1) and 10^n in A353181.

Examples

			a(2)=9 because there are 9 numbers whose digits are the same, more than half of the length 2.
		

Crossrefs

Cf. A353181, A353183 (partial sums).

Programs

  • Mathematica
    a[n_]:=Sum[Binomial[n,k]9^(n-k+1),{k,Floor[n/2]+1,n}]; Array[a,24] (* Stefano Spezia, Apr 29 2022 *)
  • Python
    import math
    def a(n):
      return (sum(math.comb(n,i)*9**(n-i+1) for i in range(n//2+1,n+1)))
    print([a(n) for n in range(1, 31)])
    
  • Python
    def a(n):
        r=[0, 9, 9]
        for i in range(n):
            r.append(-((5400+8280*i+2880*i*i)*r[i]+(-360-828*i-288*i*i)*r[i+1]+(-228-310*i-80*i*i)*r[i+2])//(21+31*i+8*i*i))
        return r[n]
    print([a(i) for i in range(1, 21)]) # Xianwen Wang, May 02 2022

Formula

a(n) = Sum_{k=floor(n/2)+1..n} C(n,k)*9^(n-k+1) (thanks to Zhao Hui Du for help in the derivation of this formula).
a(n+3) = (-(5400+8280*n+2880*n^2)*a(n)+(360+828*n+288*n^2)*a(n+1)+(228+310*n+80*n^2)*a(n+2))/(21+31*n+8*n^2) (thanks to Xianwen Wang for help in the derivation of this formula).

A353183 Number of numbers < 10^n in which more than half of the digits are the same.

Original entry on oeis.org

9, 18, 270, 603, 8307, 19737, 265257, 653742, 8672022, 21893256, 288028728, 739651770, 9675345546, 25164110070, 327788101782, 860977172187, 11178969569667, 29595164756157, 383284574197677, 1021259144052675, 13198843891723059, 35357274978994503, 456176418630573735, 1227566989710948393
Offset: 1

Views

Author

Zhining Yang, Apr 29 2022

Keywords

Examples

			a(2) = 18 because there are 18 numbers less than 10^2 in which more than half of the digits are the same: {1,2,3,4,5,6,7,8,9,11,22,33,44,55,66,77,88,99}.
		

Crossrefs

Cf. A353181, A353182 (first differences).

Programs

  • Mathematica
    a[n_]:=Sum[Sum[Binomial[m,k]9^(m-k+1),{k,Floor[m/2]+1,m}],{m,1,n}]; Array[a,24] (* Stefano Spezia, Apr 29 2022 *)
  • Python
    import math
    def a(n):
        return(sum(sum(math.comb(m,i)*9**(m-i+1) for i in range(m//2+1, m+1)) for m in range(1, n+1)))
    print([a(i) for i in range(1, 21)])
    
  • Python
    def a(n):
        r=[0, 9, 18, 270, 603]
        for i in range(n):
            r.append(-((1440+720*i)*r[i]+(-3024-1152*i)*r[1+i]+(1668+448*i)*r[2+i]+(-28-4*i)*r[3+i]+(-61-13*i)*r[4+i])//(5+i))
        return r[n]
    print([a(i) for i in range(1, 21)])

Formula

a(n) = Sum_{m=1..n} Sum_{k=floor(m/2)+1..m} C(m,k)*9^(m-k+1).
a(n+4) = ((16560 + 14040*n + 2880*n^2)*a(n) - (18036 + 15444*n + 3168*n^2)*a(n+1) + (858 + 934*n + 208*n^2)*a(n+2) + (678 + 517*n + 88*n^2)*a(n+3))/(60 + 47*n + 8*n^2).
a(n+5) = -((1440 + 720*n)*a(n) + (-3024 - 1152*n)*a(n+1) + (1668 + 448*n)*a(n+2) + (-28 - 4*n)*a(n+3) + (-61 - 13*n)*a(n+4))/(5+n).
Showing 1-2 of 2 results.