Background
Hi, I'm a programmer and I'm annoyed about a number problem that I don't know how to work.
I don't have a mathematical background. This isn't for school or for work. Just something I think about often when I program.
Goal
I would like to be able to work through problems like this on my own without having to spend hours tallying it on paper. But I don't know how to even search for help on google as I lack all terminology to describe the problem or mathematical field.
Problem
I have a set s{x} of base 10 numbers between 0 and some large number, Y.
Each number in s{x} is stored in a folder according to what digit it has in the ones, tens, hundreds, and thousands's place.
Specifically:
ones/tens/hundreds/thousands/x.txt
An example: x = 1,305,491 would be stored in the following location: 1/9/4/5/1305491.txt
The last folder on the file path is known as the terminal folder. In the above example its 5.
Question 1
How many numbers would be in each terminal folder after all numbers in |s{x}| are classified?
Attempts
So enumerating out the folder possibilities we get: ten_possible_folders/ten_possible_folders/ten_possible_folders/ten_possible_folders.
So that would be 10^3 possibilities.
I can see on paper if I tally all numbers less than 1 thousand that each terminal folder would have log(log(log(log(x)))) numbers. So each terminal folder would have one number in it.
I intuitively feel that if I were given 10 thousand numbers that each terminal folder would have ten numbers in it.
So the number of numbers in each terminal folder would be simply 10* the number of digits in Y.
Is this correct?
Question 2
The next thing I'm curious about is how to talk about what I'm asking about.
What field of mathematics studies this? It has to deal with rate of growth, so is it calculus?
Your text $n$ files will be basically evenly distributed within your $10^4$ terminal folders (not $10^3$ as you state). Therefore, the average number of files in each terminal folder would be $n/10^4$.