For my solution, 1=000000000001, 2=000000000002 and so on (we will write every number's digits up to the 12nd digit even if that digit is 0)
the numbers between 1 and 1012 are all the combination of 12 digits (10 posibilities for every digit because there are 10 digits) except for the combination 000000000000 and including the 13 digits combination 1000000000000. But both of these combinations dont contain any 3, so for us they are the same. so the question is "how many 3's are there between 0 and 1012-1.
We have exactly 1012 combinations. Lets look at the digit in the nth place (the units digit is in the first place, the tens digit is in the second place and so on). there are exactly 1/10*(the number of combinations=1012) where that digit is 3 (because there are 1011 combinations for the other 11 digits, and if we want it to have a 3 as its digit in the n place we need to put 3 as the digit in that place) meaning there are 1011 numbers between 0 and 1012-1 that contain 3 as their digit in the n place. there are 12 places, so we repeat this 12 times (we count the times 3 appears as the first digit, then count the times 3 appears as the second digit.... and so on until the 12nd digit). So, there are 12*1011 3's between 0 and 1012-1, meaning there are 12*1011 between 1 and 1012.