当前位置:网站首页>欧拉函数
欧拉函数
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;
}
边栏推荐
- 与二值化阈值处理相关的OpenCV函数、方法汇总,便于对比和拿来使用
- There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks
- 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
- 联想首次详解绿色智城数字孪生平台 破解城市双碳升级难点
- Go microservice (II) - detailed introduction to protobuf
- 牛客小白月赛7 谁是神箭手
- C # implementation defines a set of SQL statements that can be executed across databases in the middle of SQL (detailed explanation of the case)
- Hough transform Hough transform principle
- prometheus安装
- 2014 Hefei 31st youth informatics Olympic Games (primary school group) test questions
猜你喜欢
牛客小白月赛7 谁是神箭手
一文掌握数仓中auto analyze的使用
Build your own website (15)
整理混乱的头文件,我用include what you use
读写关闭的channel是啥后果?
神经网络物联网是什么意思通俗的解释
小发猫物联网平台搭建与应用模型
Oracle with as ORA-00903: invalid table name 多表报错
Hough transform Hough transform principle
[release] a tool for testing WebService and database connection - dbtest v1.0
随机推荐
A method of using tree LSTM reinforcement learning for connection sequence selection
Guys, for help, I use MySQL CDC 2.2.1 (Flink 1.14.5) to write Kafka and set
用实际例子详细探究OpenCV的轮廓绘制函数drawContours()
QT realizes interface sliding switching effect
Unity给自己的脚本添加类似编辑器扩展的功能案例ContextMenu的使用
Pytest 可视化测试报告之 Allure
1011 World Cup Betting (20 分)(PAT甲级)
Shell 编程核心技术《一》
876. 链表的中间结点
Safer, smarter and more refined, Chang'an Lumin Wanmei Hongguang Mini EV?
Is Guoyuan futures a regular platform? Is it safe to open an account in Guoyuan futures?
FPGA时序约束分享01_四大步骤简述
整理混乱的头文件,我用include what you use
神经网络物联网应用技术就业前景【欢迎补充】
2022CoCa: Contrastive Captioners are Image-Text Fountion Models
Summary and sorting of 8 pits of redis distributed lock
To sort out messy header files, I use include what you use
1672. Total assets of the richest customers
LeetCode FizzBuzz C#解答
使用canal配合rocketmq监听mysql的binlog日志