数学--数论--HDU - 6322 打表找规律
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
打表看了一下5之后,除了6之外都不是素数。
#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;
}
数学--数论--HDU - 6322 打表找规律的更多相关文章
- HDU 4919 打表找规律 java睑板 map 递归
== oeis: 点击打开链接 瞎了,x.mod(BigInteger.ValueOf(2)).equal( BigInteger.ValueOf(1)) 写成了 x.mod(BigInteger.V ...
- 数学--数论--HDU 2197 本原串 (推规律)
由0和1组成的串中,不能表示为由几个相同的较小的串连接成的串,称为本原串,有多少个长为n(n<=100000000)的本原串? 答案mod2008. 例如,100100不是本原串,因为他是由两个 ...
- 数学--数论--HDU - 6124 Euler theorem (打表找规律)
HazelFan is given two positive integers a,b, and he wants to calculate amodb. But now he forgets the ...
- 数学--数论--HDU 1792 A New Change Problem (GCD+打表找规律)
Problem Description Now given two kinds of coins A and B,which satisfy that GCD(A,B)=1.Here you can ...
- HDU 4861 Couple doubi (数论 or 打表找规律)
Couple doubi 题目链接: http://acm.hust.edu.cn/vjudge/contest/121334#problem/D Description DouBiXp has a ...
- hdu 3032 Nim or not Nim? (SG函数博弈+打表找规律)
Nim or not Nim? Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Sub ...
- HDU 5753 Permutation Bo (推导 or 打表找规律)
Permutation Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequen ...
- HDU 5795 A Simple Nim(SG打表找规律)
SG打表找规律 HDU 5795 题目连接 #include<iostream> #include<cstdio> #include<cmath> #include ...
- [国家集训队]整数的lqp拆分 数学推导 打表找规律
题解: 考场上靠打表找规律切的题,不过严谨的数学推导才是本题精妙所在:求:$\sum\prod_{i=1}^{m}F_{a{i}}$ 设 $f(i)$ 为 $N=i$ 时的答案,$F_{i}$ 为斐波 ...
随机推荐
- C语言数据结构无向图
#include<stdio.h>#include<stdlib.h>#define num 8struct nearnode{ int order; nearnode* pn ...
- Java第十六天,list接口
List接口 1.三大特点: ① 有序.② 有索引. ③ 允许存在重复元素. 注意: ① 利用list接口的索引执行操作时,要防止索引越界引起的程序错误. 2.基本使用: 针对List接口有索引的特点 ...
- 2019-07-31【机器学习】无监督学习之降维NMF算法 (人脸特征提取)
代码 from numpy.random import RandomState #加载RandomState用于创建随机种子 import matplotlib.pyplot as plt from ...
- 2019-05-12 Python之模拟体育竞赛
一.简介 可以选择任意规则,模拟不同的两个队伍进行球赛的模拟比赛 二.源代码 函数介绍: from random import * #输出介绍信息 def printIntro(): print(&q ...
- C# 基础知识系列- 10 反射和泛型(二)
0. 前言 这篇文章延续<C# 基础知识系列- 5 反射和泛型>,继续介绍C#在反射所开发的功能和做的努力.上一篇文章大概介绍了一下泛型和反射的一些基本内容,主要是通过获取对象的类型,然后 ...
- stand up meeting 1/14/2016
part 组员 工作 工作耗时/h 明日计划 工作耗时/h UI 冯晓云 主要对生词本卡片的整体设计做修改:协助主程序完成popup部分 ...
- 编写高质量Python程序(四)库
本系列文章为<编写高质量代码--改善Python程序的91个建议>的精华汇总. 按需选择 sort() 或者 sorted() Python 中常用的排序函数有 sort() 和 sort ...
- python调用小豆机器人实现自己的机器人!
大家好,人工智能是不是很酷呢? 今天我们用python调用小豆机器人实现自己的机器人(可以结合往期的语音识别更酷哦) 好,废话不多说直接上代码 import requests i=input(&quo ...
- 架构师修炼之微服务部署 - Docker简介
Docker简介 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器或Windows 机器上,也可以实现虚拟化,容器是 ...
- Windows10 下安装SourceTree 跳过注册 Bitbucket
前提:安装Git 下载Windows系统可执行文件SourceTreeSetup-3.1.3.exe 双击安装,会出现如下界面: 关闭这个界面 C:\Users\当前用户文件夹\AppData\Loc ...