This page is still under construction.

Parts of this page are still being built. What you see may change.

Diophantus of Alexandria

Time limit1sMemory limit128 MB

Summary
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 xn+yn=znx^n + y^n = z^n. Fermat conjectured that it has no integer solutions for n>2n > 2, and Andrew Wiles proved it.

Consider the following Diophantine equation.

1x+1y=1n(x,y,n∈N+)\frac{1}{x} + \frac{1}{y} = \frac{1}{n} \qquad (x, y, n \in \mathbb{N}^+)

Given nn, how many solutions (x,y)(x, y) does this equation have? (Here x≤yx \le y.) For example, when n=4n = 4 there are exactly 3 distinct solutions, shown below.

15+120=14,16+112=14,18+18=14\frac{1}{5} + \frac{1}{20} = \frac{1}{4}, \qquad \frac{1}{6} + \frac{1}{12} = \frac{1}{4}, \qquad \frac{1}{8} + \frac{1}{8} = \frac{1}{4}

Input

The first line contains the number of test cases TT. Each of the following test cases consists of a single line containing an integer nn. (1≤n≤1091 \le n \le 10^9)

Output

For each test case, first print Scenario #i: on its own line, where ii is the test case number starting from 1. On the next line, print the number of solutions of the equation for the given nn. Print one blank line between the outputs of consecutive test cases.

Examples1

  1. Example 1

    Input
    2
    4
    1260
    
    Expected output
    Scenario #1:
    3
    
    Scenario #2:
    113