-6
$\begingroup$

All odd numbers from 51 to 5001 are written. What is total number of digits used?

$\endgroup$
6
  • $\begingroup$ Why downvote??? $\endgroup$
    – AntsPiano
    Oct 23, 2020 at 17:38
  • 5
    $\begingroup$ This doesn't really seem like a puzzle. It seems like a fairly trivial math problem. $\endgroup$ Oct 23, 2020 at 17:44
  • $\begingroup$ I think there's a twist to it that makes it legit. $\endgroup$ Oct 23, 2020 at 17:47
  • 2
    $\begingroup$ If you want to ask a new question, ask a new question. Don't edit over an old already-answered puzzle. $\endgroup$
    – bobble
    Dec 22, 2020 at 23:33
  • $\begingroup$ I can’t this account is not longer accepting questions, tried to fix the probs for other questions, but there is not any thing I could fix... $\endgroup$
    – AntsPiano
    Dec 24, 2020 at 3:13

4 Answers 4

3
$\begingroup$

10. That is, the digits 0 through 9

BUT:

If this is the correct answer, the question should be relentlessly downvoted. If you're trying to trip people up with intricacies of the English language, then everything about the question must be absolutely perfect.

$\endgroup$
3
  • 2
    $\begingroup$ Relevant XKCD: xkcd.com/169 $\endgroup$ Oct 23, 2020 at 19:42
  • 1
    $\begingroup$ @Voldemort'sWrath There really is an xkcd for everything $\endgroup$ Oct 23, 2020 at 20:08
  • $\begingroup$ @TrojanByAccident -- There truly is! :):) $\endgroup$ Oct 23, 2020 at 20:09
2
$\begingroup$

Just noticed a discrepancy in the title and the body. Based on the title: There are

18,806 total digits

Logic:

From 51-99 there are 49 2 digit numbers. Then 900 3 digit numbers, then from 1,000-5,001 there are 4,002 4 digit numbers. Multiply together 49 x 2 + 900 x 3 + 4,002 x 4 to get the total count.

Based on the body (odd numbers only) it becomes:

25 x 2 + 450 x 3 + 2,001 x 4 = 9,404 digits

$\endgroup$
2
  • $\begingroup$ question said ODD numbers. But your approach is sound. $\endgroup$ Oct 23, 2020 at 17:51
  • 1
    $\begingroup$ @ChrisCudmore Yeah, I just noticed that, I was going based on the title, missed that the body was slightly different. Added both answers $\endgroup$ Oct 23, 2020 at 17:53
0
$\begingroup$

Alternate answer.

None. The letters are written out in letters.

$\endgroup$
0
$\begingroup$

Use a python code:

print(len(''.join([str(i) for i in range(51, 5002) if i%2])))

Output:

9404

Explanation:

Let me break it down:

If I do numbers = [i for i in range(1, 10)], python will interpret it as numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]. The last number is omitted, hence in my code I used range(51, 5002).

Python won't let us count the digits of numbers in a practical way, so I convert them into strings with str().

if i % 2 means if the number divided by two is not zero.

Now we have a list of all the odd numbers in strings, time to find the length. Instead of summing up the length of each number, we can connect all the strings into one large string, and then find the length of that single string. ''.join() does the trick.

Finally, I use len() to find the length of that large string and print the result.

Looping over each and every number might not be practical, but hey, it's easier to understand, right?

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.