当前位置:网站首页>Euler function
Euler function
2022-07-04 19:36:00 【Acacia moon tower】
#include <iostream>
#include <cstdio>
using namespace std;
const int Max = 100000;
int euler[Max];
void Init(){
euler[1] = 1;
for(int i = 2; i < Max; i++) {
euler[i]=i;
}
for(int i = 2; i < Max; i++) {
if(euler[i] == i) {
for(int j = i; j < Max; j += i) {
euler[j]=euler[j]/i*(i-1);
}
}
}
}
int main() {
int n;
Init();
while(scanf("%d", &n) != EOF) {
printf("%d\n", euler[n]);
}
return 0;
}
边栏推荐
猜你喜欢
LM10丨余弦波动顺势网格策略
Bi skills - permission axis
There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks
SSRS筛选器的IN运算(即包含于)用法
HMM隐马尔可夫模型最详细讲解与代码实现
Oracle with as ora-00903: invalid table name multi report error
Wireshark网络抓包
Pointnet/Pointnet++点云数据集处理并训练
Nebula importer data import practice
C# 使用StopWatch测量程序运行时间
随机推荐
HDU 6440 2018中国大学生程序设计网络选拔赛
Allure of pytest visual test report
The 300th weekly match of leetcode (20220703)
PointNeXt:通过改进的模型训练和缩放策略审视PointNet++
1005 Spell It Right(20 分)(PAT甲级)
Educational codeforces round 22 E. Army Creation
The 15th youth informatics competition in Shushan District in 2019
prometheus安装
Generate XML elements
1002. A+B for Polynomials (25)(PAT甲级)
用实际例子详细探究OpenCV的轮廓绘制函数drawContours()
OpenCV的二值化处理函数threshold()详解
项目中遇到的线上数据迁移方案1---总体思路整理和技术梳理
BCG 使用之新建向导效果
Shell 编程核心技术《三》
Leetcode fizzbuzz C # answer
生成XML元素
Introduction to polyfit software
更安全、更智能、更精致,长安Lumin完虐宏光MINI EV?
Unity给自己的脚本添加类似编辑器扩展的功能案例ContextMenu的使用