In this exercise you will build a spreadsheet that looks something like this:

The user enters an integer into the **Number** cell and then clicks on the **Find Factors**
button. Your code should then compute and display all of the factors
and prime factors for the number. Consider the following as you write
your code:

1) Before doing any calculations, you should clear out the contents where the two lists of factors are displayed to make sure you don't leave some numbers from the previous set of calculations. Pick a range that starts at the top of list (row 7 in the example above) and ends at some big number (1000 or something). If you don't know how to do this the object browser may help.

**Part A - Factors**

2) Create a **For i** loop to compute the regular factors.

3) For the **Factors** loop, start at 2 (1 doesn't
count because 1 divides into everything) and end at either n-1 or n/2.
(You can stop at n/2 if you want because once you get above that point
you won't find any more factors).

4) To determine if one number divides evenly into another number you will want to use the **Mod**
operator. The Mod operator returns number of digits in the remainder
after performing integer division on two numbers. For example:

ExpresssionResult13 Mod 5 1 9 Mod 4 2 18 Mod 6 0 27 Mod 8 3

Thus, to determine whether one number divides evenly into another, you use a conditional expression like this:

n Mod i = 0

This expression returns **True** if **i** divides evenly into **n**.

5) As you loop through the numbers and find factors, you will want
to write the results to the end of your list. Just use a variable (**myrow** for example) to keep track of the next empty row in the list. When you write something to the list, increment your row counter.

**Part B - Prime Factors**

Finding the **prime factors** can be tricky. The prime
factors are a set of prime numbers the when multiplied together, equal
the original number. The prime factors do not have to be unique. For
example, the prime factors of 8 are 2-2-2 and the prime factors of 12
are 2-2-3.

6) Create another For i loop to compute the prime factors.

7) To find the prime factors, start looping at 2 and start looking for factors like you did before. Once you find a factor, divide your original number (n) by this factor (i) to get a new value for n. Also, reset your looping variable (i) back to 2 (reset it to 1 and then when it hits the "Next i" statement at the bottom of the loop, it will be reset to 2). Then start looking for another factor.

1. Be sure to save the changes to your spreadsheet.

2. Upload your spreadsheet via Learning Suite.