
88% of all integers have a factor under 100 - psangrene
http://www.datascienceworld.com/profiles/blogs/88-per-cent-of-all-integers-have-a-factor-under-100
======
gus_massa
A few comments asked if the limit is 100%. The answer is yes, but it use some
advanced math. Luckily the main steps are nice and easy to explain theorems.
So if you blindly believe the theorems then you will be fine.

First, it's easier to think about

    
    
      q(m) = 1 - p(m) =      PROD      (1 - 1/prim(k))
                         {m = 1 to k}
    

i.e. the proportion of integers that are _not_ divisible by any of the first m
prime numbers. We want to prove the limit of q(m) is 0.

We need an auxiliary result. It is well known that the sum of the reciprocals
of the primes is infinite.
[https://en.wikipedia.org/wiki/Divergence_of_the_sum_of_the_r...](https://en.wikipedia.org/wiki/Divergence_of_the_sum_of_the_reciprocals_of_the_primes)

    
    
           SUM      1/prim(m)  =   + ∞
      {m = 1 to ∞}
    

["Intuitive fake explanation": There are infinite primes, they are not so far
away, so the sum of 1/primes is infinite.]

The second result is usual in complex analysis.
[https://en.wikipedia.org/wiki/Infinite_product](https://en.wikipedia.org/wiki/Infinite_product)
The real version says that if we have infinite numbers x(1), x(2) ,... x(m)
such that 0 <= x(m) < 1 then

* If
    
    
             SUM      x(m)  =   + ∞
        {m = 1 to ∞}
    

then

    
    
             PROD      (1 + x(m))  =  +∞
        {m = 1 to ∞}
    

and

    
    
             PROD      (1 - x(m))  =  0
        {m = 1 to ∞}
    

["Intuitive fake explanation": For the first result, (1+x) * (1+y) * (1+z) > 1
+ x + y + z . So if x + y + z + ... goes to infinite, then (1+x) * (1+y) *
(1+z) * ... goes to infinite too. The second part uses a similar idea, with
more hand waving and the fact that log(1+x) ~= x.]

Now we can join both results. If we take x(m) = 1/prim(m) then using the first
result we have that

    
    
             SUM      1/prim(m)  =   + ∞
        {m = 1 to ∞}
    

and then using the second part of the second theorem

    
    
             PROD      (1 - 1/prim(m))  =   0
        {m = 1 to ∞}

~~~
dedalus
An amazing explanation I must say regardless of all the fake disclaimers does
illuminate the key point :-)

------
Grue3
It's more surprising that it grows so slowly. 50% of integers are have a
factor under 3, 73% - under 6, but then it slows down to a trickle. 88% under
100, and just 92% under 1000.

Another interesting fact is that the sum of 1/p for every prime p diverges. It
shows that the set of primes is "large" in a certain sense. It would probably
be much easier to factorize integers if it wasn't.

~~~
demonshalo
I don't find the growth rate surprising at all!

> 50% of integers are have a factor under 3

every other number is divisible by 2, that is literally half.

> 73% - under 6

Well I think about it this way: every other number is divisible by two, every
third number is divisible by 3 and every fifth number is divisible by 5. It
just so happens that some of the numbers that are divisible by 2 are also
divisible by 3 or 5 such as 10 for instance. Thus the 73% is nor rly
surprising.

1/2 + 1/3rd of what remains + 1/5 of what remains - the intersections!

> but then it slows down to a trickle. 88% under 100, and just 92% under 1000.

I honestly expected it to be a bit lower than 92 but I am clearly wrong about
this. Here is an interesting quick visualization I made. Blue are primes,
whites are composites!

[https://imgur.com/a/7EhdI](https://imgur.com/a/7EhdI)

Edit: you can clearly notice a diagonal shape in the pic above. If you however
change the table from 5 cols to any N cols, you will get a distinct shape for
each N. It's pretty cool to play with actually. There are a ton of shapes that
have been known and used for centuries. I'd highly recommend googling around
and reading a bit about them on wikipedia!

~~~
Grue3
The growth rate of a function obviously has nothing to do with the first few
values, I don't know why you would assume those were the ones that surprised
me, or that I don't know how to calculate them. What I wanted to point out is
that this function approaches its limit (100%) very slowly, much slower than
100(1-1/n), or even 100(1-1/log(n)).

~~~
demonshalo
> or that I don't know how to calculate them.

apologies, I don't know your background nor do I have an insight as to what
goes on in your head. All I wanted to point out is that it's actually not a
surprising growth rate. And while yes, you are right about the "speed" of the
function. However that is not "unexpected". At least I don't find that to be
the case personally!

------
forinti
This post has a little graph that shows the curve you get when you plot how
many integers have factors in the first n primes:
[http://alquerubim.blogspot.com.br/2016/08/cobertura-dos-n-
pr...](http://alquerubim.blogspot.com.br/2016/08/cobertura-dos-n-primeiros-
primos.html)

~~~
stymaar
Do we know if this fonction has a limit different from 100 ? I mean, is there
a number 'x'<100 where, for any number 'n' the percentage of all integer
having a divisor below 'n' is always < x ?

~~~
idlewords
We know the limit is not 100 because of Euclid's proof of the infinitude of
primes.

~~~
drdeca
The primes become more sparse in the integers as you go farther. For most
reasonable definitions of the density of composite integers in the integers,
the density would be 100%.

Iirc, it is believed that the number of primes less than n is O(n/log(n)), so
primes/integers among the first n integers should go as O(1/log(n)), so goes
to 0 as n goes to infinity.

~~~
fdej
Not just believed, pi(n) ~ n / log(n) is the prime number theorem.

~~~
drdeca
I wasn't sure if the proof depended on the Riemann hypothesis or not.

So, I wasn't sure if it had been proven, or just proven given that assumption.
So that's why I said that it was believed.

~~~
xyzzyz
Riemann hypothesis gives better error estimates for the asymptotics in the
prime number theorem.

~~~
drdeca
Ah, alright, thanks!

------
mrcactu5
it's so strange to see Victor Granville, there is also Andrew Granville and he
writes professionally on patterns of the primes.

"Mathematicians Discover Prime Conspiracy" (Quanta Magazine, 2016)

A previously unnoticed property of prime numbers seems to violate a long-
standing assumption about how they behave.
[https://www.quantamagazine.org/20160313-mathematicians-
disco...](https://www.quantamagazine.org/20160313-mathematicians-discover-
prime-conspiracy/)

------
kazinator
50% have 2 as a factor! Many more than once. Wow!

~~~
fellellor
Generalize much.

------
igitur
Should be:

88 percent of all integers have a PRIME factor under 100

All integers have a factor under 100, which is 1.

~~~
mrkgnao
The concept of factorization, properly defined, usually excludes "units", that
is, numbers with an inverse. So 1 is a unit, since we can solve

    
    
      1x = 1 
    

by letting x = 1. -1 is a unit too, since (-1)x = 1 is also solvable.

Factorization is then defined "upto units and reordering", so, for instance,

    
    
      6 = 2 * 3 = (-2) * (-3) = 3 * 2 = (-3) * (-2)
    

are all considered the same factorization.

Why might this be useful? Sometimes, number systems ("rings") we care about
might have more units, and in order for there to be a sensible theory of
factorization[1], we have to take these things into account. Not all rings are
as nice as Z[2].

For instance, allow me to go off on a tangent: consider the set of all numbers
of the form

    
    
      a + ib (a, b integers)
    

called the Gaussian integers (written Z[i]). One can show that the units here
are 1, -1, and also two new ones: i and -i. Studying factorization in this
ring -- what numbers can we factorize further now? -- is very interesting. It
turns out that not all of our usual prime numbers "remain prime":

    
    
       2 = 1  + 1 = 1 -  i^2   = (1 + i)^2
       3 = 3 
       5 = 1  + 4 = 1 - (2i)^2 = (1 + 2i)(1 - 2i)
       7 = 7
      11 = 11
      13 = 4  + 9 = 4 - (3i)^2 = (2 + 3i)(2 - 3i)
      ...
    

The key to this puzzle is to notice that the primes that "split"[3] all leave
a remainder of 1 modulo 4. It is a beautiful fact that the converse also
holds: if

    
    
      p = 1 (mod 4) 
    

then it must factor in Z[i], and, further, it always factors as

    
    
      p = (a + ib)(a - ib) = a^2 + b^2
    

(And, of course, if we have p = a^2 + b^2, it can be factored just like we did
above.) In other words,

    
    
      Theorem[4] (Fermat, sometimes called the "Christmas theorem"). 
      The primes that can be written as a sum of two squares are exactly those congruent to 1 mod 4.
    

Neither the question (which primes can be written as a sum of two squares) nor
the answer (those congruent to 1 mod 4) involve any of the machinery we used
in getting from one to the other. :)

PS. Yes, I may or may not have ignored the case of 2 above. Tons of theorems
in number theory are stated for "odd primes". 2 is, after all, the oddest
prime.

\--

[1]: e.g. it turns out that "p is prime", defined as

    
    
      p | ab implies p | a or p | b
    

and "p is irreducible" (i.e. not factorizable in any sensible way), defined as

    
    
      p = ab implies either a or b is a unit
    

are _not_ equivalent! One direction always holds, but the other doesn't come
for free.

[https://en.wikipedia.org/wiki/Prime_element](https://en.wikipedia.org/wiki/Prime_element)

[2]: Each step up the ladder of class inclusions adds some nice property that
makes life easier, but diminishes the power of the theorems one proves.
(Euclidean domains are almost perfect in that sense!) Behold, a bestiary most
vile:

[https://en.wikipedia.org/wiki/Euclidean_domain](https://en.wikipedia.org/wiki/Euclidean_domain)

[3]: Notice that 2 factorizes as a power, not as a product of distinct
factors. This is technically "ramification", not "splitting" (that term is
reserved for the distinct-factors case). The following Wikipedia page treats
the entire content of this post far better, and has links to the "real"
algebraic number theory pages ;)

[https://en.wikipedia.org/wiki/Splitting_of_prime_ideals_in_G...](https://en.wikipedia.org/wiki/Splitting_of_prime_ideals_in_Galois_extensions#Example_.E2.80.94_the_Gaussian_integers)

The numbers that don't factorize at all are said to remain "inert". (And
there's something related called an "inertia group" that disappointingly has
little to do with mechanics.)

[4]:
[https://en.wikipedia.org/wiki/Fermat%27s_theorem_on_sums_of_...](https://en.wikipedia.org/wiki/Fermat%27s_theorem_on_sums_of_two_squares)

~~~
jessaustin
Your factorization of 2 is wrong.

(1 + i)² = 2i

2 = (1 + i)(1 - i)

I don't think that invalidates anything else you have here, much of which is
interesting.

~~~
yaks_hairbrush
The factorization of 2 is fine -- factorizations are equivalent if they're off
by a unit, and i is a unit.

By the same token, 1+i and 1-i are essentially the same prime, since you can
multiply one by a unit to get the other. That's how we can get away with
saying 2 is a power.

edit: Just noticed the sibling comment by mrkgnao, which is a very good
overview of some of the technical nitty-gritty that goes into this.

