In number theory, Euler's totient function φ(n)φ(n) counts the positive integers up to a given integer nn that are relatively prime to nn. It can be defined more formally as the number of integers kk in the range 1≤k≤n1≤k≤n for which the greatest common divisor gcd(n,k)gcd(n,k) is equal to 11. 
For example, φ(9)=6φ(9)=6 because 1,2,4,5,71,2,4,5,7 and 88 are coprime with 99. As another example, φ(1)=1φ(1)=1 since for n=1n=1 the only integer in the range from 11 to nn is 11itself, and gcd(1,1)=1gcd(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 11 and itself. So obviously 11 and all prime numbers are not composite number. 
In this problem, given integer kk, your task is to find the kk-th smallest positive integer nn, that φ(n)φ(n) is a composite number. 


InputThe first line of the input contains an integer T(1≤T≤100000)T(1≤T≤100000), denoting the number of test cases. 
In each test case, there is only one integer k(1≤k≤109)k(1≤k≤109). 
OutputFor each test case, print a single line containing an integer, denoting the answer. 

Sample Input

2
1
2

Sample Output

5
7

给定k,求第k 小的数n,满足φ(n) 是合数。
1 ≤ k ≤ 109。
Shortest judge solution: 150 bytes

打表找规律

当且仅当n = 1, 2, 3, 4, 6 时,φ(n) 不是合数。

这里不作数学证明

 1 #include <bits/stdc++.h>
2 using namespace std;
3 int main()
4 {
5 ll t , k;
6 cin >> t;
7 while(t--)
8 {
9 cin >> k;
10 if( k == 1)
11 cout << 5<<endl;
12 else cout << k+5<<endl;
13 }
14 return 0;
15 }

D - Problem D. Euler Function HDU - 6322的更多相关文章

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

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

  2. Day7 - D - The Euler function HDU - 2824

    The Euler function phi is an important kind of function in number theory, (n) represents the amount ...

  3. (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 ...

  4. HDU——T 2824 The Euler function

    http://acm.hdu.edu.cn/showproblem.php?pid=2824 Time Limit: 2000/1000 MS (Java/Others)    Memory Limi ...

  5. hdu 2824 The Euler function

    The Euler function Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  6. hdu 2824 The Euler function(欧拉函数)

    题目链接:hdu 2824 The Euler function 题意: 让你求一段区间的欧拉函数值. 题解: 直接上板子. 推导过程: 定义:对于正整数n,φ(n)是小于或等于n的正整数中,与n互质 ...

  7. hdu 2824 The Euler function 欧拉函数打表

    The Euler function Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  8. HDU 2824 The Euler function --------欧拉模板

    The Euler function Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  9. HDU——2824 The Euler function

    The Euler function Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  10. (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 ...

随机推荐

  1. Linux常用命令介绍-文档编辑

    cat命令 - 在终端设备上显示文件内容 cat命令来自英文词组concatenate files and print的缩写,其功能是在终端设备上显示文件内容.在Linux系统中有很多用于查看文件内容 ...

  2. AtCoder Beginner Contest 341-F

    AtCoder Beginner Contest 341-F F - Breakdown Problem 给你一个由 \(N\) 个顶点和 \(M\) 条边组成的简单无向图.每个顶点拥有权重\(W_i ...

  3. MyBatisPlus逆向工程

    MyBatisPlus逆向工程 一.创建Springboot工程 二.引入pom依赖 <?xml version="1.0" encoding="UTF-8&quo ...

  4. AI大模型应用开发入门-LangChain实现文档总结

    一.整体思路 长网页文本往往超过 LLM 单次处理的 token 限制,我们需要设计一个 map-reduce 流水线来拆分.局部总结.归并: 加载网页内容 拆分成可控大小的 chunk 对每个 ch ...

  5. Java中什么是类加载?类加载的过程?

    类加载指的是把类加载到 JVM 中.把二进制流存储到内存中,之后经过一番解析.处理转化成可用的 class 类 二进制流可以来源于 class 文件,或通过字节码工具生成的字节码或来自于网络.只要符合 ...

  6. 2025 FJCPC 复建 VP

    按开题顺序写 \(BCDEFGHIJKLA(D?)\),\(M\) 送的不写 B 首先发现铜铁本质等价(铜铁的转换不影响 \(val\) ),所以考虑枚举最后金和银的数量 \(gold, silver ...

  7. VLFeat库实现KD-Tree算法

    VLFeat库实现KD-Tree算法 K-D树(K-Dimensional Tree,即K维二叉树),K=1时,即是一棵普通的二叉树.常被用于高维空间中的搜索,比如范围搜索和最近邻搜索.考虑这样一种情 ...

  8. C# 托盘图标缓存清除

    https://blog.csdn.net/weixin_42953003/article/details/119676004 using System; using System.Collectio ...

  9. C# 不写模型定义一个函数类 (类似匿名函数)

    可能有点词不达意,我是这样理解的,如果有不对,请大家指点一二.通过查资料发现这个只有在C# 7.0 中才有的,慎用 在使用前需要引用 System.ValueTuple (bool state, st ...

  10. react jsx自定义标签 ts类型声明

    前言 假设我自定义了一个组件 全局导入的 <myNewElement foo="123" /> 此时ts会报异常 react18 在react 19 之前,我们可以这么 ...