当前位置:网站首页>欧拉函数
欧拉函数
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 FizzBuzz C#解答
- sqlserver的CDC第一次查询的能读取到数据,但后面增删改读取不到,是什么原因
- 【问题】druid报异常sql injection violation, part alway true condition not allow 解决方案
- 基于NCF的多模块协同实例
- Technology sharing | interface testing value and system
- ftp、sftp文件传输
- A method of using tree LSTM reinforcement learning for connection sequence selection
- An example of multi module collaboration based on NCF
- 牛客小白月赛7 I 新建 Microsoft Office Word 文档
- 与二值化阈值处理相关的OpenCV函数、方法汇总,便于对比和拿来使用
猜你喜欢
How to use async Awati asynchronous task processing instead of backgroundworker?
牛客小白月赛7 谁是神箭手
Pointnet/Pointnet++点云数据集处理并训练
[release] a tool for testing WebService and database connection - dbtest v1.0
Go微服务(二)——Protobuf详细入门
Bi skills - permission axis
Opencv functions and methods related to binary threshold processing are summarized for comparison and use
OpenCV的二值化处理函数threshold()详解
The latest progress of Intel Integrated Optoelectronics Research promotes the progress of CO packaging optics and optical interconnection technology
BI技巧丨权限轴
随机推荐
Unity editor extends C to traverse all pictures in folders and subdirectories
Safer, smarter and more refined, Chang'an Lumin Wanmei Hongguang Mini EV?
在线文本行固定长度填充工具
页面元素垂直水平居中、实现已知或者未知宽度的垂直水平居中。
Generate XML elements
如何使用Async-Awati异步任務處理代替BackgroundWorker?
1007 Maximum Subsequence Sum(25 分)(PAT甲级)
Opencv functions and methods related to binary threshold processing are summarized for comparison and use
建立自己的网站(15)
Download the first Tencent technology open day course essence!
Bi skills - permission axis
Shell programming core technology II
使用canal配合rocketmq监听mysql的binlog日志
Pytest 可视化测试报告之 Allure
The 300th weekly match of leetcode (20220703)
There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks
Upgrade the smart switch, how much is the difference between the "zero fire version" and "single fire" wiring methods?
国元期货是正规平台吗?在国元期货开户安全吗?
Hough Transform 霍夫变换原理
The difference and usage between substr (), slice (), and substring () in the string interception methods of "understand series after reading"