当前位置:网站首页>欧拉函数
欧拉函数
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;
}
边栏推荐
- Summary and sorting of 8 pits of redis distributed lock
- Caché WebSocket
- “只跑一趟”,小区装维任务主动推荐探索
- 问下各位大佬有用过cdc直接mysql to clickhouse的么
- A method of using tree LSTM reinforcement learning for connection sequence selection
- 偏移量函数及开窗函数
- redis分布式锁的8大坑总结梳理
- 牛客小白月赛7 F题
- Unity给自己的脚本添加类似编辑器扩展的功能案例ContextMenu的使用
- Unity编辑器扩展C#遍历文件夹以及子目录下的所有图片
猜你喜欢
升级智能开关,“零火版”、“单火”接线方式差异有多大?
BI技巧丨权限轴
PolyFit软件介绍
There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks
用实际例子详细探究OpenCV的轮廓绘制函数drawContours()
Pytorch学习(四)
One question per day (2022-07-02) - Minimum refueling times
YOLOv5s-ShuffleNetV2
Process of manually encrypt the mass-producing firmware and programming ESP devices
自由小兵儿
随机推荐
Download the first Tencent technology open day course essence!
The latest progress of Intel Integrated Optoelectronics Research promotes the progress of CO packaging optics and optical interconnection technology
1006 Sign In and Sign Out(25 分)(PAT甲级)
性能优化之关键渲染路径
In flinksql, in addition to data statistics, is the saved data itself a state
Explore the contour drawing function drawcontours() of OpenCV in detail with practical examples
To sort out messy header files, I use include what you use
大佬们,求助一下,我用mysql cdc 2.2.1(flink 1.14.5)写入kafka,设置
测试工程师如何“攻城”(上)
Leetcode ransom letter C # answer
An example of multi module collaboration based on NCF
生成XML元素
Using FTP
Build your own website (15)
FPGA时序约束分享01_四大步骤简述
OpenCV的二值化处理函数threshold()详解
1008 Elevator(20 分)(PAT甲级)
SSL证书续费相关问题详解
英特尔集成光电研究最新进展推动共封装光学和光互连技术进步
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