This week's book giveaway is in the Servlets forum. We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line! See this thread for details.

I need to write a program in Java that takes a positive integer and prints out all ways to multiply smaller integers that equal the original number, without repeating sets of factors. Below is my attempt so far at it. Could anyone provide some pointers?

First thing I notice is that you're calculating "n / start" a lot. For performance reasons you should retain that value instead of recalculating multiple times. You should also try to avoid division, which tends to be a slow operation compared to multiplication. For correctness reasons you should be aware that dividing integers produces an integer result - possibly not what you want.

There are more efficient ways to check if a number is prime. One easy improvement you can make is that the loop (line 59) only needs to go up to the square root of n, not n itself.

Deepika Shet: Please do not remove your question after it has been answered, it makes the thread useless to others.

For the record the original question was:

I need to write a program in Java that takes a positive integer and prints out all ways to multiply smaller integers that equal the original number, without repeating sets of factors. Below is my attempt so far at it. Could anyone provide some pointers?

Randall Twede wrote:aristophanes(or however that is spelled)[/url]

Aristophanes was an author (he wrote comedies) in ancient Greece.

Eratosthenes (with the prime sieve) was a Greek mathematician, geographer, poet, astronomer, and music theorist.
He was chief librarian of the Great Library of Alexandria, he measured (calculated) the Earth's circumference,
he founded the science of geography. He must have been a remarkable guy!

The difference between them is more than purely spelling...