This is not programming question, but math question.
To name variable we have to use letters a-z, numbers 0-9 and few special characters (-, _).
So we can use appr. 39 different characters. This is our alphabet. So to store 1000000 names we have to use names with minimum length:
log(base39)(1000000) = ~3.8
So to name million variables (to get 1000000 unique names), you have to use at least 4 characters in name. (I know about not allowed "023abc" variable names, but if we exclude them, result will not change a lot).
Answer: 4 chars. This is minimum character count. Maximum name length is limited by your compilator.