HDU6322 Problem D. Euler Function【欧拉函数+数学规律】
Problem D. Euler Function
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 1960 Accepted Submission(s): 1567
Problem Description
In number theory, Euler’s totient function φ(n) counts the positive integers up to a given integer n that are relatively prime to n. It can be defined more formally as the number of integers k in the range 1≤k≤n for which the greatest common divisor gcd(n,k) is equal to 1.
For example, φ(9)=6 because 1,2,4,5,7 and 8 are coprime with 9. As another example, φ(1)=1 since for n=1 the only integer in the range from 1 to n is 1 itself, and gcd(1,1)=1.
A composite number is a positive integer that can be formed by multiplying together two smaller positive integers. Equivalently, it is a positive integer that has at least one divisor other than 1 and itself. So obviously 1 and all prime numbers are not composite number.
In this problem, given integer k, your task is to find the k-th smallest positive integer n, that φ(n) is a composite number.
Input
The first line of the input contains an integer T(1≤T≤100000), denoting the number of test cases.
In each test case, there is only one integer k(1≤k≤109).
Output
For each test case, print a single line containing an integer, denoting the answer.
Sample Input
2
1
2
Sample Output
5
7
Source
2018 Multi-University Training Contest 3
问题链接:HDU6322 Problem D. Euler Function
问题简述:(略)
问题分析:欧拉函数问题,可以通过打表找规律。
程序说明:(略)
参考链接:(略)
题记:(略)
AC的C++语言程序如下:
/* HDU6322 Problem D. Euler Function */#include <bits/stdc++.h>int main()
{int t, n;scanf("%d", &t);while(t-- && ~scanf("%d", &n))printf("%d\n", n == 1 ? 5 : n + 5);return 0;
}
HDU6322 Problem D. Euler Function【欧拉函数+数学规律】相关推荐
- (hdu step 7.2.1)The Euler function(欧拉函数模板题——求phi[a]到phi[b]的和)
题目: The Euler function Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- XTU OJ 1355 Euler‘s Totient Function(欧拉函数)
XTU OJ 1355 Euler's Totient Function(欧拉函数) 题目描述 对于整数n,定义ϕ(n)ϕ(n)ϕ(n)为小于或等于n,并与n互质的整数的个数,比如6,比它小的和它互质 ...
- hdu5597GTW likes function+欧拉函数
Problem Description Now you are given two definitions as follows. f(x)=∑xk=0(−1)k22x−2kCk2x−k+1,f0(x ...
- Euler:欧拉函数&素数筛
一.欧拉函数 欧拉函数是小于x的整数中与x互质的数的个数,一般用φ(x)表示. 通式: 其中p1, p2--pn为x的所有质因数,x是不为0的整数. 比如x=12,拆成质因数为12=2*2*3, ...
- 欧拉函数——数学知识(c++)
定义:欧拉函数表示1-N中与N互质的数的个数: 给定一个数n,求在[1,n]这个范围内两两互质的数的个数 对于这个范围内的每一个数,我们只要找到不超过这个数且与这个数互质的数的个数就可以了 欧拉函数用 ...
- hdu 5597GTW likes function(欧拉函数)
题目链接:[hdu 5597] f(n)=sum((-1)^k * 2^(2n-2k) * C(k, 2n-k+1)) 0<=k<=n 这个公式化简之后就是f(x) = x+1 简单证 ...
- 数学/数论专题:莫比乌斯函数与欧拉函数
数学/数论专题:莫比乌斯函数与欧拉函数(进阶) 0. 前言 1. 前置知识 2. 正文 3. 总结 4. 参考资料 0. 前言 本篇文章会从狄利克雷卷积的角度,讨论莫比乌斯函数与欧拉函数的相关性质. ...
- 一欧拉函数(Euler‘s totient function)
算法总结 一欧拉函数(Euler's totient function) 欧拉函数的定义: 在数论中,对于正整数N,少于或等于N ([1,N]),且与N互质的正整数(包括1)的个数,记作φ(n). φ ...
- hdoj GTW likes function 5597 (裸欧拉函数)
GTW likes function Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Oth ...
最新文章
- bzoj1816: [Cqoi2010]扑克牌
- jQuery on()方法绑定动态元素的点击事件无效
- 4.等待链表与调度链表
- 最新研究前线-深度推荐系统真的有效吗?
- eclipse搭建SSH框架详解
- python中的可迭代对象
- 谷歌浏览器外贸版_外贸 网站移动端优化 浅析
- import keras的错误module ‘tensorflow.compat.v2‘ has no attribute ‘__internal__‘
- 硬件原理图 一键开关机电路
- Vulnhub靶机:GEMINI INC_ 1
- linux系统发送短信,Linux系统的短信收发怎么实现?
- 【Unity3D开发小游戏】《愤怒的小鸟》Unity开发教程
- 汇编指令中 Rd Rm Rn Ra 的 具体含义 ?
- 2019年8月7日暑假训练
- 蛋白质结构预测的意义、方法、数据库
- 前端修改input上传的图片大小
- Spring框架AOP原理及实现
- Python爬取京东:价格、商品ID、标题、评价、店名、是否自营
- Android Things:外设I/O接口-PWM
- Android实时语音聊天
热门文章
- Java并发编程之Lock
- PPT 如何做好关卡设计
- 小程序uniapp基础
- mac显示网速_Mac系统怎么查看测试网速
- 个人优盘更新涉密计算机病毒库,在涉密计算机和非涉密计算机之间交叉使用优盘、移动硬盘等移动存储介质时,只要及时升级杀毒软件病毒库,就不会造成泄密 - 作业在线问答...
- 部署SpringBoot项目到腾讯云或其他服务器
- Mysql逻辑架构简介
- 剑指offer面试题04. 二维数组中的查找(Array)
- 图像处理基础(五)_图像像素中通道概念解析
- DELPHI中操作ACCESS数据库