Diophantus of Alexandria
Time limit1sMemory limit128 MB
Given n, count the pairs (x, y) with x <= y satisfying 1/x + 1/y = 1/n.
- Level
Medium5 of 10
- Topics
- Number theory, Math, Combinatorics, Implementation
- Solved
- No attempts yet
Problem
Diophantus of Alexandria was an Egyptian mathematician who lived in Alexandria. He was the first mathematician to study polynomial equations that admit only integer solutions, and such equations were later named Diophantine equations in his honor.
The most famous Diophantine equation is . Fermat conjectured that it has no integer solutions for , and Andrew Wiles proved it.
Consider the following Diophantine equation.
Given , how many solutions does this equation have? (Here .) For example, when there are exactly 3 distinct solutions, shown below.
Input
The first line contains the number of test cases . Each of the following test cases consists of a single line containing an integer . ()
Output
For each test case, first print Scenario #i: on its own line, where is the test case number starting from 1. On the next line, print the number of solutions of the equation for the given . Print one blank line between the outputs of consecutive test cases.