I can not figure out the sequence of numbers between hexadecimal 288 and 2开发者_如何学CAO i really need help.
288 + 1 = 289
289 + 1 = 28A
...
28F + 1 = 290
290 + 1 = 291
...
29F + 1 = 2A0
You might want to know that even Windows calc.exe
provides a HEX mode and that Google itself can do it :)
Read this for info on base-16 numeral system
Decimal:
$ seq 0x288 0x2A0 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672
Hex:
# printf "%x\n" `seq 0x288 0x2A0` 288 289 28a 28b 28c 28d 28e 28f 290 291 292 293 294 295 296 297 298 299 29a 29b 29c 29d 29e 29f 2a0
Let's start with something simpler. What's the sequence of numbers between 32 and 45, in the 10 base, as you're used to?
After 32, there's 33, 34, 35... 39. And then, since the digits in base-10 are between 0 and 9, you advance to 40. The rightmost digit wraps back to 0, and the digit on its left becomes one bigger, thus giving you 40. From there you continue - 41,42,43,44,45.
Now, in other bases, its simply a matter of a different amount of digits. Let's take the same question (32->45), but in base 6. Base 6 has six digits - 0,1,2,3,4,5. So you go from 32 to 33, 34, 35, and here, just like you jumped from 39 to 40, you stop. There is no 36 in base 6 - you go from 5 to 0, and then you increment the left digit - hence 40. From there it's 41,42,43,44,45.
Now, with bases which are less than 10 (like base 6 above), it's easy - there are less digits. But what about base 11? base 64? or in your case, base 16? How would you represent the eleventh digit?
Here, the convention is simple. The digits turn into letters. These are the digits for base 16, the hexadecimal base:
0 1 2 3 4 5 6 7 8 9 A B C D E F
So the eleventh digit is A. The sixteenth digit is F. Let's go back to my first example but do it in the hexadecimal base. You start with 32. Go to 33, 34... 39, and then you proceed within the 30s with 3A, 3B, 3C, 3D, 3E, 3F, and here you wrap back to 0 - and jump to 40. Here is the complete sequence:
32,33,34,35,36,37,38,39,3A,3B,3C,3D,3E,3F,40,41,42,43,44,45
From here you should be able to solve 288-2A0 by yourself.
Good luck!
This C program will output the values:
#include <stdio.h>
int main() {
int i;
for(i=0x288; i<=0x2A0; i++)
printf("%X ", i);
printf("\n");
return 0;
}
Output: 288 289 28A 28B 28C 28D 28E 28F 290 291 292 293 294 295 296 297 298 299 29A 29B 29C 29D 29E 29F 2A0
Is this what you want?
精彩评论