If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

The fundamental theorem of arithmetic

Independent realization from an ancestor's perspective. Created by Brit Cruise.

Want to join the conversation?

  • mr pants teal style avatar for user Cyrus
    What is the spiral called at ?
    (53 votes)
    Default Khan Academy avatar avatar for user
  • piceratops tree style avatar for user VGruenewald
    I guess what I am not getting here is what exactly is the Fundamental Theorem of Arithmetic?
    That every number has a prime factorization? 30 = 2*3*5
    Or
    That every composite number can be broken down into the sum of equal prime numbers? 30= 5+5+5+5+5+5

    Thanks,
    Victoria
    (23 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Cameron
      The Fundamental Theorem of Arithmetic states:
      Every integer >1 has a prime factorization
      (a product of prime numbers that equals the integer, where primes may be repeated, and the order doesn't matter)
      AND
      That prime factorization is unique (This is very important)
      (for each integer there is exactly one collection of prime numbers that will work, no more, no less)

      e.g. 30=2*3*5. No matter how hard we search, we will never find a different collection of primes whose product is 30


      So what is this stuff about the sums ?

      Basically, it is discussing how Euclid discovered "For any integer X>1, X has a prime factorization".

      The video suggests at that Euclid knew that "For any integer X>1, X can be written as a sum of equal primes"

      As, it turns out, saying
      "For any integer X>1, X can be written as a sum of equal primes",
      is the same as saying
      "For any integer X>1, X has a prime factorization".

      How can these very different looking statements be the same ?

      Suppose the first statement is true ( X can be written as a sum of equal primes).
      We can find the prime factorization of X as follows:
      1. write X as a sum of equal primes, with P added N times i.e. X= P + P + P...+ P
      2. Note that this is the same as X=P * N
      3. P is prime, so if N is prime we are done.
      If N is not prime, then we can find the prime factorization for N using steps 1-3 for N and
      substitute the result for N in X= P * N.

      e.g.
      X=12
      1. 3+3+3+3=12
      2. 3*4=12
      3. 4 is not prime, find prime factorization of 4 below
      1. 2+2=4
      2. 2*2= 4
      3. 2 is prime. done
      Substitute 2*2 for 4 into 3*4=12, gives us 3*2*2=12 which is the prime factorization of 12.


      Suppose instead, that the second statement is true (X has a prime factorization).
      We can find a sum of equal prime numbers equal to X as follows:
      1. Select one of the prime factors of X, which we will call K
      2. multiply the remaining prime factors of X to produce a product called N
      3. Add K, N times to make a sum that equals X

      e.g.
      X=35
      35=5^1*7^1
      1. select 7 to be K
      2. N=5^1=5
      3. 7+7+7+7+7=35

      e.g.
      X=16
      16=2^4
      1. Select 2 to be K
      2. N=2^3=8
      3. 2+2+2+2+2+2+2+2=16

      So what this means is, if one statement is true, then the other statement is true as well.
      (And if one statment is false, then they are both false)

      Hope this makes sense
      (99 votes)
  • duskpin sapling style avatar for user jatorres37
    do they end or go on forever and never stop?
    (9 votes)
    Default Khan Academy avatar avatar for user
    • mr pink red style avatar for user Varun
      Primes go on forever, and this was proven quite simply by Euclid -

      Imagine that P1 is the first known prime (in our case 2), and P2 is the second and P3 is the third and so on. Multiply all known primes together

      P1 * P2 * P3 * P4..... until you reach the last prime you know.

      then add 1 to that product. Lets' call this x . x is not divisible by any of the primes you multiplied together, and this means that either there is a prime smaller than x that you don't know, or that x is prime. and you can repeat this process infinitely and will find new primes every time.

      Credit for that goes to Euclid.
      (45 votes)
  • blobby green style avatar for user Mike.Lima.Charlie
    I'm confused about prime factorization. Around the mark, it's said that any composite number can be broken down into smallest equal numbers. DO you really mean all composite numbers, because if I try a number like 56, I can only break it into 7x8, or 7x4x2, or 7x2x2x2 -- not by multiplying equal prime numbers.
    What am I missing?
    Thanks.
    (19 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user cmcconnell
    Why is 2 a prime number it has 1 and 1. Which are two numbers, which makes the number 2 equal.
    (5 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user mangii
    Are there any other methods of TRYING to find a pattern in prime numbers other than the Ulam spiral and is it possible to find one?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • mr pink red style avatar for user Varun
      Believe me, we've tried. A lot. There might be a pattern, but whatever it is, humans haven't found it yet. And in my opinion, if there was a pattern, prime numbers won't be half as interesting as they are.

      Also, in case you don't know, there are two common tricks to finding primes, but they're not perfect - they have exceptions and limitations, but we do have them.
      6k +/- 1 : this can find numbers that aren't divisible by 2 or 3, and they are often primes if the numbers you're dealing with are less than 100.
      You can also multiply all known primes together and add one to find a new prime number, but this misses a lot of prime numbers less than the new one you found, and, its hard to perform with large numbers.
      (5 votes)
  • duskpin ultimate style avatar for user nakshatra gayan
    what was the Greek arithmetician's name i couldn't get it ?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • leaf green style avatar for user Virupaksha reddy
    easy way of finding factors of any number
    (2 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user christian aebi
      For numbers smaller than a 1000 I would use divisibility criteria first (by 2,3,5,7,11) and if it doesn't work by Fermat's factorization method : Example. consider 377.
      The general idea is writing 377 as a difference of two squares and then using the "third identity" (a-b)(a+b) = a^2 - b^2.
      The smallest square greater than 377 is 20^2. So :
      377 = 20^2 - 23 (23 is not a square, so I add 1 to 20 and compensate by adding 2·20 + 1 to 23) so...
      377 = 21^2 - 64 = 21^2 - 8^2 = 13 · 29.
      Of course sometimes you need to do more than one iteration before getting hold of the square...the "worst" situation is if the number you started with is prime. Knowing (or being able to find quickly and easily) all squares < 1000 is of great help to start the procedure. A long example is : 949 = 31^2 - 12 = 32^2 - 75 = 33^2 - 140 = 34^2 - 207 = 35^2 -276
      = 36^2 - 347 = 37^2 - 420 = 38^2 - 495 = 39^2 - 572 = 40^2 - 651 =
      = 41^2 - 732 = 42^2 - 815 = 43^2 - 900 = 43^2 - 30^2 = 13 · 73.
      (6 votes)
  • leafers seedling style avatar for user Nathan Lim
    I tried mapping out all the prime factorizations from 2 - 20, and I saw a problem. What is the prime factorization of 16? 20? 8? This is confusing!
    (1 vote)
    Default Khan Academy avatar avatar for user
  • starky ultimate style avatar for user Arthur pan(多多or潘一乐)
    29can be spilt to two ,can it be a decimal?
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

Imagine we are living in prehistoric times. Now, consider the following. How did we keep track of time without a clock? All clocks are based on some repetitive pattern which divides the flow of time into equal segments. To find these repetitive patterns, we look towards the heavens. The sun rising and falling each day is the most obvious. However, to keep track of longer periods of time, we looked for longer cycles. For this we looked to the moon, which seemed to gradually grow and shrink over many days. When we count the number of days between full moons, we arrive at the number 29. This is the origin of a month. However, if we try to divide 29 into equal pieces, we run into a problem. It is impossible. The only way to divide 29 into equal pieces is to break it back down into single units. 29 is a prime number. Think of it as unbreakable. If a number can be broken down into equal pieces greater than one, we call it a composite number. Now, if we are curious, we may wonder how many prime numbers are there, and how big do they get? Let's start by dividing all numbers into two categories. We list the primes on the left, and the composites on the right. At first they seem to dance back and forth. There is no obvious pattern here. So let's use a modern technique to see the big picture. The trick is to use a Ulam spiral. First we list all possible numbers in order in a growing spiral. Then we color all the prime numbers blue. Finally, we zoom out to see millions of numbers. This is the pattern of primes, which goes on and on forever. Incredibly, the entire structure of this pattern is still unsolved today. We are on to something. So let's fast forward to around 300 BC in ancient Greece. A philosopher known as Euclid of Alexandria understood that all numbers could be split into these two distinct categories. He began by realizing that any number can be divided down over and over until you reach a group of smallest equal numbers. And by definition, these smallest numbers are always prime numbers. So he knew that all numbers are somehow built out of smaller primes. To be clear, imagine the universe of all numbers, and ignore the primes. Now, pick any composite number and break it down, and you are always left with prime numbers. So Euclid knew that every number could be expressed using a group of smaller primes. Think of these as building blocks. No matter what number you choose, it can always be built with an addition of smaller primes. This is the root of his discovery, known as the fundamental theorem of arithmetic, as follows. Take any number, say 30, and find all the prime numbers it divides into equally. This we know as factorization. This will give us the prime factors. In this case, 2, 3, and 5 are the prime factors of 30. Euclid realized that you could then multiply these prime factors a specific number of times to build the original number. In this case, you simply multiply each factor once to build 30. 2 times 3 times 5 is the prime factorization of 30. Think of it as a special key, or combination. There is no other way to build 30 using some other groups of prime numbers multiplied together. So every possible number has one, and only one prime factorization. A good analogy is to imagine each number as a different lock. The unique key for each lock would be its prime factorization. No two locks share a key. No two numbers share a prime factorization.