Phone Numbers And Prime Factors
June 24, 2016
John Cook is a mathematician and programmer who runs a fascinating blog that I frequent.
Cook recently had an article about the prime factors of telephone numbers. He explained that, for 10-digit telephone numbers as used in the United States, the average number of distinct prime factors is 3.232 and the distribution is between 1 and 5 distinct prime factors about 73% of the time.
Your task is to write a function that determines the number of distinct prime factors of a number, and use that function to explore the distribution of the number of distinct prime factors in a range of telephone numbers. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.
Maybe N = 10^11 is a bit small to apply the Erdos-Kac heuristic too strictly. log(log(10^11)) is only about 3.2, and it’s square root is only about 1.8. That means omega(n) = 1 corresponds to a z-value of about (1-3.2)/1.8 – say roughly -1.25 – so our sample will never include anything with a standard deviation of less than -1.25. That leaves 10% of the expected distribution of omega(n) out of the bounds of attainable values of omega(n). So it seems reasonable (to me) to expect noticeable discrepancy between the heuristic’s predictions in a large enough sample at this N.