Created
May 8, 2015 01:13
-
-
Save cloudy9101/a879e8e9e030f9cf4b62 to your computer and use it in GitHub Desktop.
Hamming Number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The sequence of Hamming numbers 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, 32, 36...... | |
Axiom 1: The value 1 is in the sequence. | |
Axiom 2: If x is in the sequence, so are 2 * x, 3 * x, and 5 * x. | |
Axiom 3: The sequence contains no other values other than those that belong to it on account of Axioms 1 and 2. | |
写一个方法 hamming(n), 返回hamming number序列(升序排列)中的第n个数 (要求输入5000能得出正确结果,并且不超时) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment