What Distribution Do Prime Factors Follow?

I decided to waste the day counting up prime factors and seeing what patterns are there. No doubt someone has already done all this but math is fun to do for yourself.

I made a little mathlet for you to explore yourself!

Image for post
Image for post

This applet calculates all of the prime divisors of all numbers 1 through N.

Then it shows the distribution of the prime divisors. https://www.mathsisfun.com/prime-factorization.html

As expected the prime divisors distribute like Benford’s Law for Random Number Distribution. https://en.wikipedia.org/wiki/Benford's_law

The first 1000 integers break down like this:

Image for post
Image for post
Image for post
Image for post

Notice that the number of 2s as factors of all numbers up through 1000 is 34% of all numbers in the factor dataset (not of all numbers 1–1000). If you play with the applet I made you can see that the number of 2s will settle down around 30%, 3s around 15%, 5s around 7% etc….

But also notice that there are 994 factor 2s, very close to the N. So in some sense you would expect this as between 1–N there are usually 50% even numbers…. so you would have at least .5N factor 2s… so you need only find another .5N 2s… but there’s also this odd thing that it’s rarely that there are N 2 factors for 1-N.

Look at N 10,000 to 50,000 and how the number of 2 factors jumps around. Sometimes 5 less sometimes 8 sometimes 7…. sometimes it’s as much as 10 factor 2s off.

Image for post
Image for post

what does that mean? . There’s also sorts of ways to slice numbers up into subclasses. For example… let’s look…

Here’s N=100 and how the numbers breakout:

Image for post
Image for post

So the prime numbers sweep out 24 of the composite odd numbers so there’s going to fewer odd prime factors showing up in the final factor counts, which is why you have fewer 3s etc. What sweeps out the 2 factors? Well, some even numbers are just less “even” than others :) . That’s my way of saying some even numbers only have one factor 2 and then some other relatively big number. For example, 22 is divisible by 2 just once, into 2*11.

Image for post
Image for post

It probably is a little more clear if we show a graph. the X axis is the N and the Y axis is the count of 2factors. You’ll see it just bounces around but does so regularly. Here’s a line plot:

Image for post
Image for post

and now just a scatterplot.

Image for post
Image for post

So some nice little cycles going on in there with the factor 2s or the “amount of evenness” hahaha. Love it.

I will probably keep exploring this even though I’m certain some math nerd has solved all this and fully accounted for it in some nice way. It’s just good to practice!

Extra Credit:
To full do Benfords law like analysis I need to actually look at each digit even in multi digit factors. for example even though 23 is prime I should extract the presence of the 2 and the 3 and count them towards the tally….

worth looking at this:

and this:

Written by

I be doing stuff. and other stuff. More stuff. http://www.worksonbecoming.com/about/ I believe in infinite regression of doing stuff.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store