Post Go back to editing

KCC's Quizzes AQQ275 about counting a particular digit in a series of numbers

1. Quote of the week:

                          

2. New quiz: 

Good luck and try to be among the first ones (i.e. or award and reward...)

Kuo-Chang

P.S. Quizzes are open to all (ADI, Partners, friends...): forward them if you think they can be interested!

The deep link is  Logic Lounge 

Please share your answer to view other submitted answers
  • 30 times
    102,112,122,132,142,152,162,172,182,192, and so on for 200 and 300 series till 400.

  • The digit 2 appears 160 times.

    100-109 appears 1 time (102)
    110-119 appears 1 time (112)
    120-129 appears 11 times (120, 121, 122, 123, 124, 125, 126, 127, 128, 129)
    130-199 appears 7 times (132, 142, 152, 162, 172, 182, 192)
    200-209 appears 11 times (200, 201, 202, 203, 204, 205, 206, 207, 208, 209)
    210-219 appears 11 times (210, 211, 212, 213, 214, 215, 216, 217, 218, 219)
    220-229 appears 21 times (220, 221, 222, 223, 224, 225, 226, 227, 228, 229)
    230-219 appears 11 times (230, 231, 232, 233, 234, 235, 236, 237, 238, 239)
    240-219 appears 11 times (240, 241, 242, 243, 244, 245, 246, 247, 248, 249)
    250-219 appears 11 times (250, 251, 252, 253, 254, 255, 256, 257, 258, 259)
    260-219 appears 11 times (260, 261, 262, 263, 264, 265, 266, 267, 268, 269)
    270-219 appears 11 times (270, 271, 272, 273, 274, 275, 276, 277, 278, 279)
    280-219 appears 11 times (280, 281, 282, 283, 284, 285, 286, 287, 288, 289)
    290-299 appears 11 times (290, 291, 292, 293, 294, 295, 296, 297, 298, 299)
    300-309 appears 1 time (302)
    310-319 appears 1 time (312)
    320-329 appears 11 times (320, 321, 322, 323, 324, 325, 326, 327, 328, 329)
    330-400 appears 7 times (332, 342, 352, 362, 372, 382, 392)

  • Digit 2 appears as third digit in all the integers like 102, 112, 122, ...., 192, 202, 212, ....., 292, 302, 312,...., 392. Total number is 30. Then it appears as second digit in numbers like 120, 121, 122,...., 129, 220, 221, ....., 229, 321, 322, ....., 329 for a total number of 30 again. And then it appears in the first digit in all the integers like 200, 201, 202,....., 299 for a total number of 100. So the answer is 30+30+100=160. 

  • To solve this either count no of 2s so 101 to 199 301 to 400 there will 20*2 =40 and from from 200 to 300 there will be 100+20 then total no of 2s will be 160

    Or else we can simulate it by writing some simple c code so one function will be to go through 100 to 400 and this will be calling one function that will be calculating no of times 2is present like this we will get the results

  • This seems straightforwards, which probably means I'm missing something, but...

    If we're counting the total appearances of "2", then that's 100 from the integers 200-299 in the hundreds digit, 10/100 for each hundred (100, 200, 300) for the tens digit (30), and another 10/100 for each hundred for the ones digit (30).

    Total of 160, "2"s, then.

  • From  0 to 10, it appears once. 
    From 0 to 100, excluding 20 to 29, it appears so 9 times  ( 02, 12, 32, 42, 52, 62, 72, 82, 92)
    From 20 to 29  it appears 11 times  (20, 21, 22 (two times), 23, ... 29), so, for the first 100 cycle, that makes  9+11 = 20 times.
    From 100 to 199 and from 300 to 399, that would make 2*20  = 40 times
    From 200 to 299, that will make 100 times more than the "regular" 20  times,  so 120 times
    So, from 100 to 400,  that makes 160 times

  • The digit "2" will appear 160 times

  • Through enumeration:
    100 102 112 120 121 122 123 124 125 126 127 128 129
    132 142 152 162 172 182 192
    Total = 20

    The same for the 300 => 392 range
    New total = 40

    For the 200 => 299 range add 100 to 20 = 120

    Grand total = 160 times

  • But 2 appears (at least once) in 138 different numbers from 100 to 400  (138 = 19  + 100 +19)
    It appears exactly 3 times in just one number (222)
    It appears not a single time in 162 numbers ( 2*(100-19) )
    It appears exactly twice in 20 numbers  (122, 322, and  202, 212, 232, 242, 252, 262, 272, 282, 292, and 220, 221, 223, 224, 225, 226, 227, 228, 229)
    So it appears exactly once in 300-1-162-20 = 117 numbers (I haven't double checked that count though.)