Problem:
Problem J: No Story

Since I got tired to write long problem statements, I decided to make this problem statement short. For given positive integer L, how many pairs of positive integers a, b (a ≤ b) such that LCM(a, b) = L are there? Here, LCM(a, b) stands for the least common multiple of a and b.

Input

For each dataset, an integer L is given in a line. Input terminates when L = 0.

Output

For each dataset, output the number of pairs of a and b.

Constraints

1 ≤ L ≤ 1012

Sample Input

12
9
2
0

Output for the Sample Input

8
3
2

Solution in C (judge verdict: Wrong Answer)

// AOJ 1060: No Story
// 2017.10.7 bal4u@uu
// 2017.12.15

#include <stdio.h>

#define MAX 1000000
int power[100], sz;
char tbl[1000001];

int psz;
int ptbl[78500] = {			// ptbl[166] = 997, ptbl[78496] = 999983
         3,   5,   7,  11,  13,  17,  19,  23,  29,
   31,  37,  41,  43,  47,  53,  59,  61,  67,  71,
   73,  79,  83,  89,  97, 101, 103, 107, 109, 113,
  127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
  179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
  233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
  283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
  353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
  419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
  467, 479, 487, 491, 499, 503, 509, 521, 523, 541,
  547, 557, 563, 569, 571, 577, 587, 593, 599, 601,
  607, 613, 617, 619, 631, 641, 643, 647, 653, 659,
  661, 673, 677, 683, 691, 701, 709, 719, 727, 733,
  739, 743, 751, 757, 761, 769, 773, 787, 797, 809,
  811, 821, 823, 827, 829, 839, 853, 857, 859, 863,
  877, 881, 883, 887, 907, 911, 919, 929, 937, 941,
  947, 953, 967, 971, 977, 983, 991, 997 };

void sieve()
{
	int i, j, k;

	for (i = 0; i < 167; i++) {
		k = ptbl[i];
		for (j = k*k; j < MAX; j += k) tbl[j] = 1;		// k*k ?
	}
	for (psz = 166, i = 997; i <= MAX; i += 2) if (!tbl[i]) ptbl[psz++] = i;
	ptbl[psz] = 0;
}

void prime_factor(long long n)
{
    int b;
    int *pp;

    sz = 0;
    if (!(n & 1)) {
        power[sz] = 0;
        do n >>= 1, power[sz]++;
        while (!(n & 1));
        sz++;
    }
	for (pp = ptbl; n > 1 && *pp; pp++) {
		if (n % *pp) continue;
		b = *pp, power[sz] = 0;
		do n /= b, power[sz]++;
	    while (n % b == 0);
		sz++;
	}
}

int main()
{
	long long n, ans;
	int i;

	sieve();
	while (scanf("%lld", &n) && n > 0) {
		if (n == 1) { puts("1"); continue; }
		if (n <= MAX && !tbl[n]) { puts("2"); continue; }
        prime_factor(n);
		for (ans = 1, i = 0; i < sz; i++) ans = ans * (1 + (power[i] << 1));
        printf("%lld\n", (ans+1)>>1);
	}
	return 0;
}