Return

Interesting numbers

Here's some interesting numbers. They're not necessarily "interesting", but there's some useful qualities about them, especially for programmers.


Minimum divisible by all

These numbers are divisible by X and all whole numbers below it. For example the number 2520 is divisible by 10, 9, 8, 7, 6, 5, 4, 3, and 2.

Note: only the minimum values are listed, for example 24 is divisible by 4, 3, and 2, but it's redundant because 12 is divisible by the same numbers.

#divisible byNotes
2<= 2
6<= 3
12<= 4
60<= 6fits into i8, u8
420<= 7
840<= 8
2520<= 10
27,720<= 12fits into i16, u16
360,360<= 15
720,720<= 16
12,252,240<= 18
232,792,560<= 22fits into i32, u32
5,354,228,880<= 24
26,771,144,400<= 26
80,313,433,200<= 28
2,329,089,562,800<= 30
72,201,776,446,800<= 31
144,403,552,893,600<= 36
5,342,931,457,063,200<= 40
219,060,189,739,591,200<= 42
9,419,588,158,802,421,600<= 46fits into i64, u64

Code used to generate this list
u64 latest = 2;
u64 maxcount = 0;
for (u64 i=2; i; i+=latest) {
	u64 count = 0;
	for (u64 x=2; !(i%x); x++) {
		count = x;
	}
	if (count > maxcount) {
		maxcount = count;
		latest = i;
		printf("%llu is divisible by <= %llu\n", i, count);
	}
	if (i < latest) break; // i overflowed
}

Power of 2

"Power of 2" basically means any number created with , also known as 2^x, also known as pow(2,x). Replace x with any number.

One use is that they represent the value range of a given number of bits. For example 4 bits (2^4) can represent 16 different values; 0 to 15.

#PowerNotes
22^1
42^2
82^3
162^4
322^5
642^6
1282^7signed 8-bit integer range (-128 - 127)
2562^8unsigned 8-bit integer range (0 - 255)
5122^9
1,0242^10
2,0482^11
4,0962^12
8,1922^13
16,3842^14
32,7682^15signed 16-bit integer range (-32,768 - 32,767)
65,5362^16unsigned 16-bit integer range (0 - 65,535)
131,0722^17
262,1442^18
524,2882^19
1,048,5762^20
2,097,1522^21
4,194,3042^22
8,388,6082^23
16,777,2162^24float can store integers roughly up to here
33,554,4322^25
67,108,8642^26
134,217,7282^27
268,435,4562^28
536,870,9122^29
1,073,741,8242^30
2,147,483,6482^31signed 32-bit integer range (-2,147,483,648 - 2,147,483,647)
4,294,967,2962^32unsigned 32-bit integer range (0 - 4,294,967,295)
8,589,934,5922^33
7,179,869,1842^34
4,359,738,3682^35
8,719,476,7362^36
137,438,953,4722^37
274,877,906,9442^38
549,755,813,8882^39
1,099,511,627,7762^40
2,199,023,255,5522^41
4,398,046,511,1042^42
8,796,093,022,2082^43
17,592,186,044,4162^44
35,184,372,088,8322^45
70,368,744,177,6642^46
140,737,488,355,3282^47
281,474,976,710,6562^48
562,949,953,421,3122^49
1,125,899,906,842,6242^50
2,251,799,813,685,2482^51
4,503,599,627,370,4962^52
9,007,199,254,740,9922^53 double can store integers roughly up to here
18,014,398,509,481,9842^54
36,028,797,018,963,9682^55
72,057,594,037,927,9362^56
144,115,188,075,855,8722^57
288,230,376,151,711,7442^58
576,460,752,303,423,4882^59
1,152,921,504,606,846,9762^60
2,305,843,009,213,693,9522^61
4,611,686,018,427,387,9042^62
9,223,372,036,854,775,8082^63signed 64-bit integer range
(-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807)
18,446,744,073,709,551,6162^64unsigned 64-bit integer range
(0 - 18,446,744,073,709,551,615)
340,282,366,920,938,463,463,374,607,431,768,211,4552^128u128

Code used to generate this list
int power = 0;
u64 x = 1;
while (1) {
	power ++;
	x *= 2;
	printf("2^%i = %llu\n", power, x);
	if (x == 0) break; // x overflowed
}
printf("2^64 = %llu + 1\n", (u64)(U64_MAX));