Find all problems that equal an integer [duplicate]

In this challenge, your job is to write a program that allows a user to enter an integer. Then, the program must find all the possible ways of multiplying two numbers to get the user's integer.
Rules:

• The program should not show any problem more than once.
• The user should be able to enter any integer.
• The program should only show problems that contain 2 numbers.
• The shortest program (in Bytes) wins.
• It does not matter what order the program outputs the problems in.

Example Output (user enters 20, then the program outputs the problems):

20

1 * 20
2 * 10
4 * 5

• So basically this is just "factor an integer." predicts ridiculously short Mathematica solution Jan 18, 2014 at 19:27
• @DoorknobofSnow yes but all possible factorizations. Jan 18, 2014 at 19:28
• What do you mean "yes, but all possible factorizations"? That's what factoring is. Unless you mean including non-integer "factors", in which case there are infinite solutions.
– jscs
Jan 18, 2014 at 20:23
• This is just factoring, which has been done before: Factorize me!!!, Find prime factors Jan 18, 2014 at 20:36

Perl 6, 5452 49 characters

my \i=get;i%$_||say$_,"*",i/$_ for 1...^*>i.sqrt Iterates through each integer from 1 to the first number greater than the square root of the input (* > i.sqrt), excludes that last number (...^), and prints (say$_,"*",i/$_) unless the number doesn't divide the input evenly (i %$_ ||)

Let's give VIM some love (96 chars)

let n=input('')|for x in range(1,n/2-1)|for y in range(1,n)|if x*y==n|ec x."*".y|en|endfo|endfo

The abbreviations ec, en and endfo stand for echo, endif and endfor respectively.

I was rather disappointed that I couldn't use fo; that expands to fold.

python, 857975 73 characters

i,j=1,int(raw_input())
while i*i<=j:
if j%i==0:
print i,"*",j/i
i+=1

This can probably be improved drastically...

• Pretty good (for Python!) Jan 18, 2014 at 20:13
• Design for readability really kills in codegolf, but I bet Java can't beat that :P Jan 18, 2014 at 20:13

JavaScript, 64 characters

Algorithm: run for loop till square root of the input number and if n % i == 0 alert the pair of numbers.

my $n=20; for(1..sqrt($n)){
say "$_ * ",$n/$_ if$n%\$_ == 0;