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

%I #20 Mar 05 2024 15:53:54

%S 0,1,2,3,5,6,7,8,10,11,12,13,15,16,17,18,20,21,22,23,25,26,27,28,30,

%T 31,32,33,35,36,37,38,49,50,51,52,53,55,56,57,58,60,61,62,63,65,66,67,

%U 68,70,71,72,73,75,76,77,78,80,81,82,83,85,86,87,88,94,100,101,102

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

%t Select[Range[0, 200], DigitCount[#, 10, 4] == DigitCount[#, 10, 9] &] (* _Vincenzo Librandi_, Oct 27 2016 *)

%o (Magma) [n: n in [0..120] | Multiplicity(S, 4) eq Multiplicity(S, 9) where S is {*d: d in Intseq(n)*}]; // _Vincenzo Librandi_, Oct 27 2016

%o (Python)

%o from itertools import count, islice

%o def A039145_gen(startvalue=0): # generator of terms >= startvalue

%o return filter(lambda k:(s:=str(k)).count('4')==s.count('9'),count(max(startvalue,0)))

%o A039145_list = list(islice(A039145_gen(),40)) # _Chai Wah Wu_, Mar 05 2024

%K nonn,base,easy

%O 1,3

%A _Olivier GĂ©rard_