#P2247. Humble Numbers

    ID: 1248 传统题 1000ms 256MiB 尝试: 1 已通过: 1 难度: 10 上传者: 标签>动态规划数据结构模拟其他数学Ulm Local 1996

Humble Numbers

题目描述

若一个数的质因数仅为22335577,则称其为**“Humble数”**。例如,序列$1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, \ldots$展示了前20个Humble数。

编写一个程序,找出并输出该序列中的第nn个元素。

输入格式

输入包含一个或多个测试用例。每个测试用例为一个整数nn1n58421 \leq n \leq 5842)。输入以n=0n=0结束。

输出格式

对于每个测试用例,输出一行:“The {n}th humble number is {number}.”。注意,根据nn的取值,需使用正确的序数后缀(如“st”、“nd”、“rd”或“th”),具体格式参考样例。

样例输入

1  
2  
3  
4  
11  
12  
13  
21  
22  
23  
100  
1000  
5842  
0  

样例输出

The 1st humble number is 1.  
The 2nd humble number is 2.  
The 3rd humble number is 3.  
The 4th humble number is 4.  
The 11th humble number is 12.  
The 12th humble number is 14.  
The 13th humble number is 15.  
The 21st humble number is 28.  
The 22nd humble number is 30.  
The 23rd humble number is 32.  
The 100th humble number is 450.  
The 1000th humble number is 385875.  
The 5842nd humble number is 2000000000.