Pagini recente » Cod sursa (job #2023475) | Cod sursa (job #1727723) | Cod sursa (job #2948603) | Cod sursa (job #2472377) | Cod sursa (job #1324602)
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cstdio>
#include <cstdlib>
using namespace std;
int v[100111];
int main(int argc, char *argv[])
{
freopen("sum.in", "r", stdin);
freopen("sum.out", "w", stdout);
int n;
scanf("%d", &n);
for(int i = 2; i <= 100001; i++) {
v[i] = i;
}
for(int i = 2; i <= 100001; i++) {
if(v[i] == i) {
for(int j = i; j <= 100001; j += i) {
v[j] = v[j] / i * (i - 1);
}
}
}
for(int i = 1; i <= n; i++) {
int x;
scanf("%d", &x);
printf("%lld\n", (long long)2 * x * v[x]);
}
return 0;
}