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.

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

This page as a plain text file.
%I A353182 #51 Dec 26 2024 20:29:11
%S A353182 9,9,252,333,7704,11430,245520,388485,8018280,13221234,266135472,
%T A353182 451623042,8935693776,15488764524,302623991712,533189070405,
%U A353182 10317992397480,18416195186490,353689409441520,637974569854998,12177584747670384,22158431087271444,420819143651579232,771390571080374658
%N A353182 Number of n-digit numbers in which more than half of the digits are the same.
%C A353182 a(n) is the number of terms between 10^(n-1) and 10^n in A353181.
%H A353182 Zhining Yang, <a href="/A353182/b353182.txt">Table of n, a(n) for n = 1..300</a>
%H A353182 Project Euler, <a href="https://projecteuler.net/problem=788">Problem 788, Dominating Numbers</a>
%F A353182 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).
%F A353182 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).
%e A353182 a(2)=9 because there are 9 numbers whose digits are the same, more than half of the length 2.
%t A353182 a[n_]:=Sum[Binomial[n,k]9^(n-k+1),{k,Floor[n/2]+1,n}]; Array[a,24] (* _Stefano Spezia_, Apr 29 2022 *)
%o A353182 (Python)
%o A353182 import math
%o A353182 def a(n):
%o A353182   return (sum(math.comb(n,i)*9**(n-i+1) for i in range(n//2+1,n+1)))
%o A353182 print([a(n) for n in range(1, 31)])
%o A353182 (Python)
%o A353182 def a(n):
%o A353182     r=[0, 9, 9]
%o A353182     for i in range(n):
%o A353182         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))
%o A353182     return r[n]
%o A353182 print([a(i) for i in range(1, 21)]) # _Xianwen Wang_, May 02 2022
%Y A353182 Cf. A353181, A353183 (partial sums).
%K A353182 nonn,base,easy
%O A353182 1,1
%A A353182 _Zhining Yang_, Apr 29 2022