login
A344636
Numbers k such that half the numbers from 0 to k inclusive contain the digit "1".
4
1, 17, 23, 161, 269, 271, 1457, 3397, 3419, 3421, 13121, 44685, 118097, 674909, 674933, 1062881
OFFSET
1,2
COMMENTS
Andrew Hilton (see Ref) refers to these as "half-one" numbers.
REFERENCES
Andrew Hilton, 101 Puzzles to Solve on your Microcomputer, 1984, HARRAP, page 57.
EXAMPLE
1 is a term since among the numbers 0,1 exactly half contain a digit "1".
17 is a term since among the numbers 0,1,2,...,17 exactly half contain a digit "1".
MATHEMATICA
Select[2Range@2000, Length@Select[Range[0, #-1], MemberQ[IntegerDigits@#, 1]&]==#/2&]-1 (* Giorgos Kalogeropoulos, Jul 28 2021 *)
PROG
(Python 3)
z=1
z_s = str(z)
counts=0
for x in trange (0, 100000000000):
x_s = str(x)
if z_s in x_s:
counts += 1
if counts / (x+1) == 0.5:
print(x)
CROSSREFS
KEYWORD
nonn,base,fini,full
AUTHOR
Glen Gilchrist, May 25 2021
STATUS
approved