Under construction

Still being built. Things may change

Palindromic Factors

Time limit2sMemory limit1024 MB

Summary
Count the divisors of A that read the same forward and backward in decimal.
Level

Easy3 of 10

Topics
Math, Number theory
Solved
No attempts yet

Problem

You are given a positive integer AA. Find the number of factors of AA that are palindromes. A number is called a palindrome if it reads the same when the digits in its decimal representation are reversed. For instance, 121 is a palindrome, while 123 is not.

Input

The first line of the input gives the number of test cases, TT. TT lines follow. Each line contains a single integer AA.

Output

For each test case, output one line containing Case #x: y, where xx is the test case number (starting from 1) and yy is the number of factors of AA that are palindromes.

Constraints

1≤T≤1001≤T≤100.

Hint

In the first test case, AA has 4 palindromic factors: 1, 2, 3, and 6.

In the second test case, AA has 3 palindromic factors: 1, 2, and 5.

In the third test case, AA has 7 palindromic factors: 1, 2, 3, 4, 6, 8, and 9.

In the fourth test case, AA has 6 palindromic factors: 1, 2, 11, 22, 121, and 242.

Examples1

  1. Example 1

    Input
    4
    6
    10
    144
    242
    
    Expected output
    Case #1: 4
    Case #2: 3
    Case #3: 7
    Case #4: 6