链接:http://acm.hdu.edu.cn/showproblem.php?pid=6322

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
 
Recommend
chendu   |   We have carefully selected several similar problems for you:  6331 6330 6329 6328 6327 
题解:给你一个数k,让你求让你求第k 个gcd(num,x)的个数为合数(除了1)的num,x为从1 ~ num-1,这题题名写着欧拉函数,很明显让你求第k个欧拉函数值为合数的数;
显然,由于大于3的质数都满足题意(根据欧拉函数知道,质数的欧拉函数值为x-1,必为大于2的偶数)
对于奇数: 有当m,n互质时,有f(mn)=f(m)f(n),根据任何数都可以由多个质数的多少次幂相乘得到,故,对于质数num,其可以由一个质数乘另一个数得到,质数和任意数都是互质的,故f(num)=f(x)f(y){假设x为质数},则,f(num)=(x-1)*f(y),由(x-1)为偶数,且f(y)>1,则对于任意奇数都是满足题意的;
对于偶数:由上同理可以推出只有6不满足题意:故只要排除6即可;从4开始遍历:
参考代码为:
#include<bits/stdc++.h>
using namespace std; int main()
{
int t;
long long k;
cin>>t;
while(t--)
{
cin>>k;
if(k==1) cout<<5<<endl;
else cout<<k+5<<endl;
}
return 0;
}

  

2018HDU多校训练-3-Problem D. Euler Function的更多相关文章

  1. HDU 6322.Problem D. Euler Function -欧拉函数水题(假的数论题 ̄▽ ̄) (2018 Multi-University Training Contest 3 1004)

    6322.Problem D. Euler Function 题意就是找欧拉函数为合数的第n个数是什么. 欧拉函数从1到50打个表,发现规律,然后勇敢的水一下就过了. 官方题解: 代码: //1004 ...

  2. 2018HDU多校训练-3-Problem M. Walking Plan

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=6331 Walking Plan  Problem Description There are n inte ...

  3. 2018HDU多校训练-3-Problem G. Interstellar Travel

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=6325                                   Interstellar Tra ...

  4. 2018HDU多校训练一 K - Time Zone

    Chiaki often participates in international competitive programming contests. The time zone becomes a ...

  5. 2018HDU多校训练-3-Problem F. Grab The Tree

    Little Q and Little T are playing a game on a tree. There are n vertices on the tree, labeled by 1,2 ...

  6. 2018HDU多校训练一 D Distinct Values

    hiaki has an array of nn positive integers. You are told some facts about the array: for every two e ...

  7. 2018HDU多校训练一 C -Triangle Partition

    Chiaki has 3n3n points p1,p2,-,p3np1,p2,-,p3n. It is guaranteed that no three points are collinear.  ...

  8. 2018HDU多校训练一 A - Maximum Multiple

    Given an integer nn, Chiaki would like to find three positive integers xx, yy and zzsuch that: n=x+y ...

  9. (2018 Multi-University Training Contest 3)Problem D. Euler Function

    //题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6322 //题目大意:给定 k,求第 k 小的数 n,满足 φ(n) 是合数.显然 φ(1) = 1 ...

随机推荐

  1. 在VMware CentOS7挂载系统光盘搭建本地仓库

    1.软件准备: 安装VMware环境,在这里我使用的是VMware15 一个虚拟机系统,在这里我使用的是CentOS7(版本不同可能会有一点出入,但是应该相差不大) 在这里还有一个前提是已经建立好了y ...

  2. JVM原理速记复习Java虚拟机总结思维导图面试必备

    良心制作,右键另存为保存 喜欢可以点个赞哦 Java虚拟机 一.运行时数据区域 线程私有 程序计数器 记录正在执行的虚拟机字节码指令的地址(如果正在执行的是Native方法则为空),是唯一一个没有规定 ...

  3. 力扣(LeetCode)求众数 个人题解

    给定一个大小为 n 的数组,找到其中的众数.众数是指在数组中出现次数大于 ⌊ n/2 ⌋ 的元素. 你可以假设数组是非空的,并且给定的数组总是存在众数. 示例 1: 输入: [3,2,3] 输出: 3 ...

  4. 编译带libev和libuv的libwebsocket (Win平台)

    编译使用libwebsockets-2.0-stable版本. 编译依赖项目cmake,lws项目配置和生成依赖python, gpy工具依赖gpy, libuv项目配置和生成依赖,又一个项目配置和生 ...

  5. H3C 交换机设置本地用户和telnet远程登录配置 v7 版本

    H3C 交换机设置本地用户和telnet远程登录配置   v7版本 一.配置远程用户密码与本地用户一致 [H3C]telnet server en //开启Telnet 服务 [H3C]local-u ...

  6. 2019-9-25:渗透测试,基础学习,medusa爆破学习

    Medusa(美杜莎)暴力破解使用 该文章仅供学习,利用方法来自网络文章,仅供参考 一.简介 medusa(美杜莎)是一个速度快,支持大规模并行,模块化,爆破登陆,可以同时对多个主机,用户或是密码执行 ...

  7. 📈📈📈📈📈iOS 图表框架 AAChartKit ---强大的高颜值数据可视化图表框架,支持柱状图、条形图、折线图、曲线图、折线填充图、曲线填充图、气泡图、扇形图、环形图、散点图、雷达图、混合图

    English Document

  8. linux shell编程之变量和bash配置文件(第一篇)

    编程语言有两类 强类型:如C语言.数据具有其特定的类型,先声明定义后才能使用.数据运算时必须符合类型要求(如不能把字符串类型数据直接与整型数据做算数运算) 弱类型:如shell.数据默认为字符型,不用 ...

  9. LESSON 1-Introduction

    Keywords: Communication system, Channel model, Channel capacity by Shannon 1. Two fundamental archit ...

  10. python基础-网络编程part01

    软件开发架构 C/S(Client / Server) 架构 概念:是一种软件系统体系结构.Client是客户端,Server是服务端.客户端需要安装专用的客户端软件. 比如:微信.QQ.王者荣耀等应 ...