prime numbers, counters, help!

Hi, I'm having a little trouble with a program I was assigned. Basically, the program has to ask for a number and produce a table that indicates the prime factorization of the number's absolute value.

For example, if the user enters the number 245, the program has to do:

Number is: 245

Sign is: +

Prime factorization of 245 is:

PRIME FACTOR | POWER

===========| =======

5 | 1

7 | 2

the professor gives us this pseudocode as a guide:

1. **Repeat for** k = 2,3,...,n

a. Determine if *k* is prime

b. **if** (*k* is prime) then

1. Determine the maximum value of *d* such that *k^d* is a factor (divisor) of [i]n[/n]

2. if (*d* > 0) then

*k* is a prime factor of *n*

*d* is the exponent

He says that's the hard pard of the proyect

Im not asking for a complete program, i just want ideas on how to calculate prime numbers, and, *if possible* the Prime Factor part of the table :/