Arithmancy is Draco Malfoy's favorite subject, but what spoils it for him is that Hermione Granger is in his class, and she is better than him at it.  Prime numbers are of mystical importance in Arithmancy, and Lucky Numbers even more so. Lucky Numbers are those positive integers that have at least three distinct prime factors; 30 and 42 are the first two. Malfoy's teacher has given them a positive integer n, and has asked them to find the nth lucky number. Malfoy would like to beat Hermione at this exercise, so although he is an evil git, please help him, just this once.  After all, the know-it-all Hermione does need a lesson.

Input (STDIN):

The first line contains the number of test cases T. Each of the next T lines contains one integer n.

Output (STDOUT):

Output T lines, containing the corresponding lucky number for that test case.

Constraints:

1 <= T <= 20

1 <= n <= 1000

Sample Input:

2

1

2

 ,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,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
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
};
/*int main()
{ int o=1,flag;
for(int m=1;m<100000;m++)
{
if(
((m%2==0)&&(m%3==0)&&(m%5==0))||
((m%2==0)&&(m%3==0)&&(m%7==0))||
((m%2==0)&&(m%3==0)&&(m%11==0))||
((m%2==0)&&(m%3==0)&&(m%13==0))||
((m%2==0)&&(m%3==0)&&(m%17==0))||
((m%2==0)&&(m%3==0)&&(m%19==0))||
((m%2==0)&&(m%7==0)&&(m%5==0))||
((m%2==0)&&(m%11==0)&&(m%5==0))||
((m%2==0)&&(m%13==0)&&(m%5==0))||
((m%2==0)&&(m%17==0)&&(m%5==0))||
((m%2==0)&&(m%19==0)&&(m%5==0))||
((m%2==0)&&(m%7==0)&&(m%11==0))||
((m%2==0)&&(m%7==0)&&(m%13==0))||
((m%2==0)&&(m%7==0)&&(m%17==0))||
((m%2==0)&&(m%7==0)&&(m%19==0))||
((m%2==0)&&(m%11==0)&&(m%13==0))||
((m%2==0)&&(m%11==0)&&(m%17==0))||
((m%2==0)&&(m%11==0)&&(m%19==0))||
((m%2==0)&&(m%13==0)&&(m%17==0))||
((m%2==0)&&(m%17==0)&&(m%19==0))||
((m%3==0)&&(m%7==0)&&(m%5==0))||
((m%11==0)&&(m%3==0)&&(m%5==0))||
((m%13==0)&&(m%3==0)&&(m%5==0))||
((m%17==0)&&(m%3==0)&&(m%5==0))||
((m%19==0)&&(m%3==0)&&(m%5==0))||
((m%7==0)&&(m%3==0)&&(m%11==0))||
((m%7==0)&&(m%3==0)&&(m%13==0))||
((m%7==0)&&(m%3==0)&&(m%17==0))||
((m%7==0)&&(m%3==0)&&(m%19==0))||
((m%11==0)&&(m%3==0)&&(m%13==0))||
((m%11==0)&&(m%3==0)&&(m%17==0))||
((m%11==0)&&(m%3==0)&&(m%19==0))||
((m%13==0)&&(m%3==0)&&(m%17==0))||
((m%13==0)&&(m%3==0)&&(m%19==0))||
((m%17==0)&&(m%3==0)&&(m%19==0))||
((m%11==0)&&(m%7==0)&&(m%5==0))||
((m%13==0)&&(m%7==0)&&(m%5==0))||
((m%17==0)&&(m%7==0)&&(m%5==0))||
((m%19==0)&&(m%7==0)&&(m%5==0))||
((m%17==0)&&(m%11==0)&&(m%5==0))||
((m%19==0)&&(m%11==0)&&(m%5==0))||
((m%13==0)&&(m%11==0)&&(m%5==0))||
((m%13==0)&&(m%11==0)&&(m%7==0))||
((m%17==0)&&(m%11==0)&&(m%7==0))||
((m%19==0)&&(m%11==0)&&(m%7==0))||
((m%17==0)&&(m%13==0)&&(m%11==0))||
((m%19==0)&&(m%13==0)&&(m%11==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0))||
((m%19==0)&&(m%17==0)&&(m%13==0)) )
{
flag=0;
for(int q=m-1;q>0;q--)
{
if(a[q]==m)
flag=1;
}
if(flag==0)
{
a[o]=m;
o=o+1;
}
}
}
int n;
scanf("%d",&n);
FILE *fp;//建立一个文件操作指针
fp=fopen("1.txt","w+");//以追加的方式建立或打开1.txt,默认位置在你程序的目录下面
for(int i=0;i<n;i++)
{ printf("%d\n",a[i]);
fprintf(fp,"%d,\n",a[i]);
}
return 0;
} */
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
int m;
scanf("%d",&m);
printf("%d\n",a[m]);
}
return ;
}

最新文章

  1. Java线程:线程的同步与锁
  2. PHP将部分内容替换成星号
  3. PS切图的几种方式
  4. 用cxf开发restful风格的WebService
  5. noip2010-t2
  6. eclipse如何连接oracle 11g数据库
  7. [转]GLES 3.0 新特性
  8. Storm基础知识
  9. 老李推荐: 第3章1节《MonkeyRunner源码剖析》脚本编写示例: MonkeyRunner API使用示例
  10. Selenium 高阶应用之WebDriverWait 和 expected_conditions
  11. 菜单栏-Place(放置)菜单
  12. Android app去掉https签名校验
  13. iOS崩溃日志ips文件解析
  14. Python 求点到直线的垂足
  15. c# excel xlsx 保存
  16. Bitlocker驱动器加密使用
  17. nodejs图片总结
  18. Linux 黑白界面显示
  19. JavaScript实现弹出层(以layer.open为例)
  20. Apache HttpComponents 文件上传例子

热门文章

  1. HDU 6199 2017沈阳网络赛 DP
  2. poj1102
  3. python面向对象(五)之多态
  4. 安装window系统
  5. P2471 [SCOI2007]降雨量
  6. 关于SizeOf、Length
  7. Luogu P1750 【出栈序列】
  8. 四B象限图
  9. Python装饰器讲解
  10. fedora常见问题和解决方案