login
Numbers whose base-10 representation has the same number of 1's and 9's.
1

%I #21 Jun 26 2021 01:54:21

%S 0,2,3,4,5,6,7,8,19,20,22,23,24,25,26,27,28,30,32,33,34,35,36,37,38,

%T 40,42,43,44,45,46,47,48,50,52,53,54,55,56,57,58,60,62,63,64,65,66,67,

%U 68,70,72,73,74,75,76,77,78,80,82,83,84,85,86,87,88,91,109,129,139

%N Numbers whose base-10 representation has the same number of 1's and 9's.

%C A k-digit number is in the sequence with probability ~ 1/sqrt(2*Pi*k/5). - _Charles R Greathouse IV_, Feb 19 2014

%C The number of d-digits positive terms is given by 7*8^(d-1)+ 7*sum(k=1,..,floor((d-1)/2), 8^(d-1-2*k) (k, k, d-1-2*k)!) + 2*sum(k=1,..,floor(d/2), 8^(d-2*k) (k, k-1, d-2*k)!), where (x,y,z)! = (x+y+z)!/(x! y! z!) denotes a multinomial coefficient. (* _Giovanni Resta_, Feb 22 2014 *)

%H Vincenzo Librandi, <a href="/A039127/b039127.txt">Table of n, a(n) for n = 1..1500</a>

%t Select[Range[0,200],DigitCount[#,10,1]==DigitCount[#,10,9]&] (* _Harvey P. Dale_, Feb 19 2014 *)

%o (PARI) is(n)=my(v=digits(n)); sum(i=1,#v, if(v[i]==1, 1,if(v[i]==9, -1,0)))==0 \\ _Charles R Greathouse IV_, Feb 19 2014

%K nonn,base,easy

%O 1,2

%A _Olivier GĂ©rard_