当前位置:网站首页>欧拉函数
欧拉函数
2022-07-04 17:59:00 【相思明月楼】

#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;
}
边栏推荐
- Leetcode ransom letter C # answer
- Shell programming core technology "three"
- 与二值化阈值处理相关的OpenCV函数、方法汇总,便于对比和拿来使用
- How to use async Awati asynchronous task processing instead of backgroundworker?
- 升级智能开关,“零火版”、“单火”接线方式差异有多大?
- Pointnet/Pointnet++点云数据集处理并训练
- 2022-07-04: what is the output of the following go language code? A:true; B:false; C: Compilation error. package main import 'fmt' func
- 26. Delete the duplicate item C solution in the ordered array
- Qt实现界面滑动切换效果
- 大佬们,求助一下,我用mysql cdc 2.2.1(flink 1.14.5)写入kafka,设置
猜你喜欢

物联网应用技术的就业前景和现状

在线文本行固定长度填充工具

Go微服务(二)——Protobuf详细入门

Stream流

建立自己的网站(15)

英特尔集成光电研究最新进展推动共封装光学和光互连技术进步

There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks

The 300th weekly match of leetcode (20220703)

Process of manually encrypt the mass-producing firmware and programming ESP devices

从实时应用角度谈通信总线仲裁机制和网络流控
随机推荐
Shell programming core technology "four"
1002. A+B for Polynomials (25)(PAT甲级)
OpenCV的二值化处理函数threshold()详解
Shell 编程核心技术《三》
Have you guys ever used CDC direct Mysql to Clickhouse
HDU 1097 A hard puzzle
大佬们,求助一下,我用mysql cdc 2.2.1(flink 1.14.5)写入kafka,设置
Safer, smarter and more refined, Chang'an Lumin Wanmei Hongguang Mini EV?
Shell programming core technology II
Summary and sorting of 8 pits of redis distributed lock
测试工程师如何“攻城”(下)
读写关闭的channel是啥后果?
Guys, for help, I use MySQL CDC 2.2.1 (Flink 1.14.5) to write Kafka and set
QT realizes interface sliding switching effect
在线文本行固定长度填充工具
The kth largest element in the array
876. Intermediate node of linked list
请教一下 flinksql中 除了数据统计结果是状态被保存 数据本身也是状态吗
爬虫(6) - 网页数据解析(2) | BeautifulSoup4在爬虫中的使用
自由小兵儿