CSC231 Powers of 2

From dftwiki3
Revision as of 10:09, 8 October 2010 by Thiebaut (talk | contribs) (Created page with '--~~~~ ---- =Program= <source lang="python"> #! /bin/env python import locale locale.setlocale(locale.LC_ALL, "") x = 1 for i in range( 65 ): print "2^%d = " % (i), locale.f…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut 14:09, 8 October 2010 (UTC)


Program

#! /bin/env python
import locale
locale.setlocale(locale.LC_ALL, "")

x = 1
for i in range( 65 ):
    print "2^%d = " % (i), locale.format( '%d', x,  True )
    x = x * 2

Powers of 2

2^0 =  1
2^1 =  2
2^2 =  4
2^3 =  8
2^4 =  16
2^5 =  32
2^6 =  64
2^7 =  128
2^8 =  256
2^9 =  512
2^10 =  1,024
2^11 =  2,048
2^12 =  4,096
2^13 =  8,192
2^14 =  16,384
2^15 =  32,768
2^16 =  65,536
2^17 =  131,072
2^18 =  262,144
2^19 =  524,288
2^20 =  1,048,576
2^21 =  2,097,152
2^22 =  4,194,304
2^23 =  8,388,608
2^24 =  16,777,216
2^25 =  33,554,432
2^26 =  67,108,864
2^27 =  134,217,728
2^28 =  268,435,456
2^29 =  536,870,912
2^30 =  1,073,741,824
2^31 =  2,147,483,648
2^32 =  4,294,967,296
2^33 =  8,589,934,592
2^34 =  17,179,869,184
2^35 =  34,359,738,368
2^36 =  68,719,476,736
2^37 =  137,438,953,472
2^38 =  274,877,906,944
2^39 =  549,755,813,888
2^40 =  1,099,511,627,776
2^41 =  2,199,023,255,552
2^42 =  4,398,046,511,104
2^43 =  8,796,093,022,208
2^44 =  17,592,186,044,416
2^45 =  35,184,372,088,832
2^46 =  70,368,744,177,664
2^47 =  140,737,488,355,328
2^48 =  281,474,976,710,656
2^49 =  562,949,953,421,312
2^50 =  1,125,899,906,842,624
2^51 =  2,251,799,813,685,248
2^52 =  4,503,599,627,370,496
2^53 =  9,007,199,254,740,992
2^54 =  18,014,398,509,481,984
2^55 =  36,028,797,018,963,968
2^56 =  72,057,594,037,927,936
2^57 =  144,115,188,075,855,872
2^58 =  288,230,376,151,711,744
2^59 =  576,460,752,303,423,488
2^60 =  1,152,921,504,606,846,976
2^61 =  2,305,843,009,213,693,952
2^62 =  4,611,686,018,427,387,904
2^63 =  9,223,372,036,854,775,808
2^64 =  18,446,744,073,709,551,616