You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
752 B
C++

#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 50050;
bool notPrime[N];
ll primes[N], pcnt;
int main()
{
for (ll i = 2, j; i < N; i++)
if (!notPrime[i])
for (primes[pcnt++] = i, j = i * i; j < N; j += i)
notPrime[j] = true;
int n;
while (scanf("%d", &n), n)
{
ll ans = 1;
for (int i = 0; i < pcnt; i++)
{
int cnt = 0;
for (int j = n; j % primes[i] == 0; j /= primes[i])
cnt++;
ans *= (2 * cnt + 1);
}
printf("%d %lld\n", n, ans / 2 + 1);
}
return 0;
}