Talk:Power of two/Archive 1

Categories for binary number algorithms
I think rounding to nearest power of two number should be put to some algorithm/computer arithmetic category, or even some other article. Rounding to nearest power of two is often related to computer programs and it would make sense to have some article/category listing the relevant methods. Any ideas which category/article? Shd 16:01, 8 October 2006 (UTC)

First forty-one powers of 2
This phrase can be reworded as "first through forty-first", not "zeroth through fortieth". Any faulty thinking?? Georgia guy 21:06, 21 October 2006 (UTC)

Radix vs Power
This page seems to confuse radix-2 with power of 2. Radix 2 implies 2 to the n (2n), while power of 2 implies "n to the power of 2" or n2. This is a common mistake, so I have tried to fix those improper references. —The preceding unsigned comment was added by 65.242.3.72 (talk • contribs) 14:22, 16 March 2007 (UTC)


 * What makes you think there is a mistake? Every Google hit for "powers of two" I can find refers to 2^n. 18:51, 16 March 2007 (UTC)

What's 5 to the power of 2? 25. What's 2 to the power of 5? 32. This page is mileading simply because it forces people to look at the context "power of 2" is used in to try to guess what's really meant. As for the Google search: What's "popular" is not always right; what's right is not always popular. Why don't you look up Radix-2 and Radix-4 FFT definitions and try to figure out how they got their name? You are perpetuating a common ambiguity that only serves to add confusion to a discipline which requires precise language usage. Petersk 20:14, 18 March 2007 (UTC)


 * You're playing with words. Anyway, Wikipedia does not allow you to claim that the universally understood meaning of "power of two" is somehow "wrong" unless you can attribute that claim to a reliable source. Melchoir 20:28, 18 March 2007 (UTC)


 * OK, please, just refer to the wikipedia page on radix . I make no additional claim. Both pages cannot be right, unless your page is deliberately ambiguous. Petersk 20:30, 18 March 2007 (UTC)


 * Although one sometimes hears the phrasing "raised to the power of" something, a "power of 2" is never something raised to the second power. A "power of 2" is 2 raised to some power. This is standard mathematical terminology and I'm afraid that it's you who are misinterpreting the term. Dcoetzee 22:18, 18 March 2007 (UTC)


 * I'm not even too sure where to go with this last comment... What's 5 to the power of 2?  You've really never heard of that terminology before?  I can show you lots of algebra/pre-calculus books that make that exact statement, so I am not sure what "standard" you're referring to.  Do you have any doubt of someone's intent when they say that number is radix-2? (I am actually starting to doubt you even heard of the term radix or radius until this conversation.)  Which is more clear and precise leaving no room for doubt? Just because someone in computer science got it wrong a while ago doesn't mean that this must still be perpetuated, especially in a wiki.  Did you bother even looking at the radix wiki? 68.228.142.173 23:35, 18 March 2007 (UTC)


 * There is a difference between having a power of two and being a power of two. You are simply being confused by the multiple meanings of the word "of" in English grammar.
 * That's the substance of the issue; here's the procedure. There is no evidence, certainly not in our Radix article, supporting your usage of the word, and context is everything in Wikipedia policy. This website is an encyclopedia as well as a wiki; it is purely descriptive, and it does not advocate new language for any reason. You'll be happier if you stop thinking in terms of "right" and "wrong". Melchoir 23:55, 18 March 2007 (UTC)


 * The "new" language is using "power of" instead of "radix". Computer science came after mathematics as a discipline -- I use that term loosely when referring to computer science.  Perhaps a good compromise is to allow modification of this site pointing out that radix is the historically more correct way of describing numbes that are radix-2 and refering to the radix wiki? 68.228.142.173 13:17, 23 March 2007 (UTC)


 * An historical claim still demands verification, and it still is not found in the Radix article. Melchoir 18:03, 23 March 2007 (UTC)
 * How about we start out with the US Department of Commerce? Chapter 28, p 1012, "Representation of Numbers" states the use of base or radix. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables, edited by Milton Abramowitz and Irene A. Stegun, National Bureau of Standards Applied Mathematics Series 55, Issued June 1964.  I'm referencing the tenth printing, Dec 1972.  The American Heritage Dictionary, second College Edition, c 1982,1985, under '"power".  Math. a. An exponent, b. the number of elements in a finite set.' Is two enough, considering the author only has a Master's degree and references nothing but google? 68.228.142.173 11:41, 28 March 2007 (UTC)


 * Those sources do not appear to support your claim. Certainly the second doesn't, and you haven't quoted the first. "Representation of Numbers" sounds like the usual usage of the word radix: indicating the base of a numeral system. For example, one would say that the number three is written 11 in radix 2. One would not go on to say that three is "radix-2", or that 11 is "radix-2". Substituting four or 100 would make no difference. Melchoir 00:28, 3 April 2007 (UTC)
 * I don't see how you can say that. The sources clearly delineate how numbers should be represented.  I don't need to quote the first source, because a careful reading clearly shows the meaning and accepted usage, which in no way includes "power of".  As for saying 4 is radix-2, that is, in fact, accepted and used -- showing your ignorance.  But that's neither here nor there.  Where are the sources that define "power of two" the way the author does?  The first to the trough is not, by definition, removed from any burden of proof or use of references. Let's see some authoritative documentation of that definition.  Petersk 16:46, 12 April 2007 (UTC)
 * Done. Now where's your radix-2 source? Melchoir 20:50, 12 April 2007 (UTC)
 * How many more do I need to provide that you'll summarily discount? I'll have to take a look at the sources you just provided and see if they meet the same "test" that you have given my two above. But... that being said, please pick up the latest "Embedded Systems Design" magazine (April 2007).  There's a nice article by MIT professor Anant Agarwal (yes, the guy that's written multiple books).  Surprisingly, on page 50, in his article, "Going Multicore Presents Challenges and Opportunities," he clearly uses the term "power of n" where he talks of an "n-fold" increase (implying n is in the exponent), thus validating from yet another source this wikipedia article's lack of validity. 68.228.142.173 16:17, 15 April 2007 (UTC)
 * Does Anant Agarwal specifically claim that a power of two is a number of the form n^2? Melchoir 19:32, 15 April 2007 (UTC)
 * I reiterate that the anonymous contributor is incorrect; a "power of two" is a number of the form 2n. I've seen it defined as such in many published papers and authoritative reference books. There is no room for argument here. Dcoetzee 23:34, 3 December 2007 (UTC)

Next biggest algorithm
The algorithm has unnecessary dependencies and probably suboptimal performance in modern CPUs. It relies on writing the value of n on every statement, while all ORs are independent.


 * And it's unnecessarily hardcoded; a loop (while n != 0) would be shorter, more general, and often faster. For that matter, why not for (j=1; ; j<<=1) { if (j>=n) break } ?  —Tamfang (talk) 19:03, 31 January 2008 (UTC)

Some patterns
Some patterns I noticed that might be placed in the article: No exponent of two is divisible by and odd number, or at least 3. The other one would best be expressed square root of 2n=2(n-1) where n=or>4. Someone make that a formula for me. Can anyone check these for me? 141.156.190.218 02:22, 28 February 2007 (UTC)
 * The first one is almost correct, although all powers of two are divisible by one (which is odd). This property can be generalized: a power of any prime can only be divided by other powers of the same prime.  (You can prove this to yourself by thinking about the prime factorization of the power of a prime, and the property of divisibility that if X is divisible by Y, then all of the elements of Y's prime factorization have to appear in X's prime factorization.)  Since odd numbers are ones that can't be divided by two, then no power of two can be odd (except for $$2^0=1$$).
 * Your second hypothesis isn't quite accurate, though. As a couple of counterexamples, $$\sqrt{2^6} = 8 = 2^3$$, and $$\sqrt{2^5}$$ isn't a power of two at all (it's not even a whole number).  You're close, though... keep working at it.
 * I'm glad that you're excited about finding properties of numbers. You can have a lot of fun looking for interesting patterns in numbers, like the Hardy-Ramanujan number.  While it's fun and interesting to find these properties, many of them aren't notable enough to be included in an encyclopedia, so I don't think it's worth putting these in the article.  --Piquan (talk) 00:48, 29 February 2008 (UTC)


 * Have you noticed the year in the post you replied to? It's the only post by that IP. PrimeHunter (talk) 01:13, 29 February 2008 (UTC)

It says "nonnegative integer" in the article. Now, 0 is the first nonnegative integer, 1 is the second, 2 is the third, 3 is the fourth, etc. However, 8, which corresponds to the exponent of 3, is thought of as the third power of 2, not the fourth, and 1 is thought of as the zeroth. Any modifications to the first paragraph of the article?? Georgia guy 21:05, 8 Jan 2005 (UTC)
 * This is kind of tricky. In common parlance we say that a is the cth power of b if a = bc, even if it is not the cth in a list of nonnegative powers of b. I've even heard people say "the one-halfth power" for the square root. It's a bit sloppy, and maybe we can rephrase it, but it's pretty common. Deco 02:54, 11 Jan 2005 (UTC)

Suggested merge from polite number
I have placed a tag on polite number suggesting that it be merged here. The polite numbers are exactly the non-powers-of-two, so they are not independently interesting as a number sequence. The relevant fact is that an integer N can be represented as a sum of consecutive integers, if and only if N is not a power of two; this seems worth mentioning here, with a link to the website listed on the polite number page, rather than making a whole separate article for that factoid. —David Eppstein (talk) 18:33, 5 February 2008 (UTC)


 * I am not sure if this merge is a good idea. If someone is looking for what a polite number is, and he will get redirected to powers of two, where will be no explanation what impolite numbers are (at least in the intro, I guess), it will just be more confusing. I think a separate, although probably always small, article, is better. Samohyl Jan (talk) 09:58, 6 February 2008 (UTC)


 * polite numbers are of independent interest as a set of numbers that can be investigated in an educational context. Basically they are an interesting problem that can be given to school students. Nick Connolly (talk) 22:32, 6 May 2008 (UTC)

Word Size
The sentence discussing common CPU register quantities has a linked directing the reader to read the article about word size. Word size has nothing to do with the quantity of CPU registers. —Preceding unsigned comment added by 70.113.46.77 (talk) 16:16, 3 December 2007 (UTC)

WTF: "2^64: The number of distinct values representable in a single word on a 64-bit processor. Or, the number of values representable in a dword (double word) on a 32-bit processor. -> since when is a DWORD 64bit on a 32-bit system? —Preceding unsigned comment added by 90.152.179.135 (talk) 12:18, 26 April 2009 (UTC)
 * Your rant inspired me to add a footnote explaining that Intel redefined "word" to a fixed length; I don't know of any other architecture this is true of, though I don't know of any other that's gone through the bit extensions x86 has. BioTube (talk) 00:45, 28 September 2009 (UTC)

340,282,366,920,938,463,374,607,431,768,211,456
IPv6

http://www.google.com/search?hl=en&source=hp&q=340%2C282%2C366%2C920%2C938%2C463%2C374%2C607%2C431%2C768%2C211%2C456+&btnG=Google+Search&aq=f&aqi=&oq=

Seems to me that,


 * 340,282,366,920,938,463,374,607,431,768,211,456

is 2 "raised to the power" 128 (i.e., 128-bit). The number quoted here seems to be have a  repetition typo ,


 * 340,282,366,920,938, 463,463 ,374,607,431,768,211,456

eh? ArmchairVexillologistDonLives! (talk) 03:50, 12 February 2010 (UTC)


 * Wikipedia is right. 2128 contains "463,463". There are also far more Google hits (currently 19600 versus 425 for your number) on the right number: http://www.google.com/search?hl=en&source=hp&q=340%2C282%2C366%2C920%2C938%2C463%2C463%2C374%2C607%2C431%2C768%2C211%2C456+&btnG=Google+Search&aq=f&aqi=&oq=. PrimeHunter (talk) 12:47, 12 February 2010 (UTC)

Sum of powers of two
Any integer power of two is equal to the sum of every previous integer powers of two. I am not sure if there exists another base for which this is true, but I think it would be interesting putting this here since it is an interesting related idea. What does anyone else think? GabKBel (talk) 23:00, 21 April 2010 (UTC)
 * Its not quite true. You need to add one to this sum to get the power of two. For a power of N (integer at least 2), the sum times (N-1) then plus the one is the the power of N. Karl (talk) 11:56, 22 April 2010 (UTC)


 * Your answer is correct for non-negative integer powers of 2 but GabKBel only said integer powers. GabKBel is correct if the infinitely many negative powers are included since 2-1+2-2+2-3+... = 1. PrimeHunter (talk) 13:48, 22 April 2010 (UTC)


 * To avoid confusion this is what I mean
 * $$ \sum_{k=-\infty}^n 2^k = 2^{n+1}.$$
 * Which is what PrimeHunter had said. The extra 1 that you need is actually the sum of all the negative powers of 2, and that's why I find it is an interesting remark.GabKBel (talk) 22:39, 22 April 2010 (UTC)
 * Yes. I took it to be a finite sum of integer valued powers, which start from the zeroth power. Karl (talk) 11:49, 23 April 2010 (UTC)


 * Now the question is whether or not it is worth including in the article, and being a new member I rather have a more experienced opinion. GabKBel (talk) 22:08, 23 April 2010 (UTC)


 * It's easy to prove it is true but Wikipedia really likes reliable sources, both to establish verifiability and notability. If you have a reliable source which considered this worth mentioning then I think an addition to the article would be OK. PrimeHunter (talk) 14:48, 23 April 2010 (UTC)


 * Essentially, it comes up in math problems often, as in the geometric series. As a derivation of this property, we can see that the sum of k natural powers of 2 will be equal to 2^(k+1)-1, which I have been told is often used in programming, though PrimeHunter might be more qualified to assert this. Besides that, I cannot think of a source for notability, so I will leave it to the discretion of the more experienced editors.GabKBel (talk) 22:08, 23 April 2010 (UTC)

2^n - 1 not a square?
I was told, without a proof, that 2^n−1 is never a square number. Is it true? Is there a short proof? Is it important enough to be included? Rainald62 (talk) 18:53, 7 September 2010 (UTC)
 * Well. 2^0 -1 = 0 and 2^1 - 1 = 1 are squares. For n > 1, 2^n - 1 is congruent to -1 modulo 4, whereas an odd square is congruent to +1. Not worth including, I would have thought, unless you can find a significant source for it. AndrewWTaylor (talk) 11:52, 8 September 2010 (UTC)
 * moved to a new section for clarity AndrewWTaylor (talk) 11:54, 8 September 2010 (UTC)


 * Considering you had to ask about this, I'm not sure you are familiar with congruences. In that case you may prefer this explanation: If 2m+1 is any odd number then (2m+1)^2 = 4m^2+4m+1 is 1 more than a multiple of 4. If n>1 then 2^n-1 = 4*2^(n-2)-1 is 1 less than a multiple of 4. I agree it's not worth including. PrimeHunter (talk) 13:52, 8 September 2010 (UTC)
 * Thanks for clarifying my explanation, PH. AndrewWTaylor (talk) 10:58, 9 September 2010 (UTC)

Meaning of bold entries in table
In Power of two, certain entries are bold, and the top row of each set of columns as a different background-color (almost like a header-format) than the rest. There is no annotation for the meaning of boldness. I can't think of any reason the "top" rows should be different. If anything, the top row should be a standard table-header-row ("Exponential form"//"Value" or "Power"//"value" (and that second option only giving the n value not the 2^n exponential-form). Having the table column-wrapped is already a bit hard to read and an accessibility problem, I would at least like to see markup used rationally here. DMacks (talk) 20:04, 31 August 2012 (UTC)

Algorithm to find the next-highest power of two is wrong
Strictly speaking the C++ code given is incorrect. The intended semantics for the expression (sizeof(unsigned long)*8) is to get the number of bits in an unsigned long. This is only correct on platforms where char is 8 bits. ANSI C/C++ do not require that a char is 8 bits and indeed on some platforms it isn't. —Preceding unsigned comment added by 69.108.17.6 (talk) 00:08, 24 March 2009 (UTC)
 * I was just going to say this. I'm pretty sure this use of CHAR_BIT is incorrect. What would really be required is some kind of BITS_PER_BYTE constant, but I don't think that exists in limits.h. In practice it is probably fine to hardcode the value as 8. 204.246.225.2 (talk) 17:58, 31 July 2012 (UTC)

It should be clarified that the algorithm returns the same number when its input is already a power of 2. Which is kind of unexpected because - for me - a function that returns a "next" value of any kind never returns its input. By removing the "k--;" line, the algorithm actually returns the _next_ power of two. —Preceding unsigned comment added by 85.116.199.95 (talk) 15:11, 25 October 2010 (UTC)

The code for signed integers is wrong for a number of reasons. For example, assume 32-bit, signed (2's complement) integers. The algorithm fails for -2^31 (= 1 << 31), and for all positive values greater than 2^30 because positive 2^31 cannot be represented. It is inefficient in that it continues to loop for small values unnecessarily.

How to fix the algorithm is open to some interpretation as to how to handle the various cases, but I would recommend the following coding in Java (which is close to what C++ would look like):

I think "ceiling" in the method name is a little clearer than "next". For the n > 1<<30 problem I recommend returning 1<<30 rather than garbage. The n<=0 catches the -2^31 problem and returns 1 rather than 0 (since there is no real, finite exponent of 2 (positive or negative) that results in zero).

I would be glad to contribute this on the main page (if it passes muster here), but I am unclear If I should since I don't have a "reference" for the above. I am new to this editing business, but would like to help.

LeeRhodes (talk) 17:42, 7 September 2012 (UTC)

C++ code
I've cleaned up some of the C++ implementations in this article (that is to say, I've removed them). I had to do this recently in another article, so I'll just link to the explanation there, I think it covers all the points: Determinant - C++ code. Please consider them seriously before adding more computer code here. Wikis are not well suited for such things. Eniagrom (talk) 13:40, 10 October 2012 (UTC)

opposite to 2^X ?
i know that the opposite of x^2 is sqrt(x) so how do you get the opposite of 2^X.. google doesnt seem to know Xroot... Charlieb000 (talk) 22:57, 17 October 2012 (UTC)
 * log2x. See logarithm. —David Eppstein (talk) 00:06, 18 October 2012 (UTC)

Recent IP edits are not vandalism
surprisingly. It would be interesting to investigate who is credited for this mistake in elementary arithmetics: 286 and onwards. Incnis Mrsi (talk) 06:33, 24 January 2013 (UTC)
 * Yes, I saw that. The error seems to have been introduced from last September, when a different IP editor added the powers from 84 to 96 . —David Eppstein (talk) 07:10, 24 January 2013 (UTC)

Lacuna
Even more amazing than the oppressive emphasis here on "computing!1!11!!" is that nowhere is there mention of negative powers of two. The lede second paragraph dismissively consigns negative powers to the outer wastes, with only positive powers being of any proper interest.

Where else would negative powers of two be mentioned than here? The Exponentiation does have a one sentence mention. Gosharooney! Shenme (talk) 04:36, 9 March 2018 (UTC)

Tone
This article has a serious tone problem, comparable to an informal conversation. For example: Additionally, the statements above indicate that the article contains original research.
 * Numbers that are not powers of two occur in a number of situations, such as video resolutions, but they are often the sum or product of only two or three powers of two, or powers of two minus one. For example, $640 = 32 × 20$, and $480 = 32 × 15$. Put another way, they have fairly regular bit patterns.
 * One can see that starting with 2 the last digit is periodic with period 4, with the cycle 2–4–8–6–, and starting with 4 the last two digits are periodic with period 20. These patterns are generally true of any power, with respect to any base. The pattern continues, of course, where each pattern has starting point $2^{k}$, and the period is the multiplicative order of 2 modulo $5^{k}$, which is $&phi;(5^{k})$ = 4 &times; $5^{k&minus;1}$ (see Multiplicative group of integers modulo n).

Perhaps some of the material fails WP:IINFO. Unfortunately, there is no ambox specifically for WP:IINFO-related concerns. – Laundry Pizza 03  ( d c&#x0304; ) 09:38, 4 June 2018 (UTC)

English units of measure for volume
A section with the following table was added today by 76.25.100.26. I reverted it with edit summary "A large table of old English units of volume doesn't belong here".

The English units of measure for volume use powers of two.

PrimeHunter (talk) 12:46, 28 May 2010 (UTC)


 * I'm copying this table to my user page in case anyone ever needs it for encyclopedic purposes. JohnSmith13345 (talk) 14:30, 8 September 2019 (UTC)

integers one less than a power of two
What do you think about creating new article about " one less than a power of two" similar to power of two ? --Adam majewski (talk) 16:29, 6 May 2019 (UTC)
 * Is it a notable topic that would have substantive content, apart from Mersenne primes? DMacks (talk) 17:23, 6 May 2019 (UTC)


 * You should probably first find out whether there already is a name for such numbers and whether an article exists for them. I would start by looking in List of numbers, List of types of numbers, Number, and Integer. Otherwise, if you can collect several noteworthy properties of integers one less than a power of two, that would be great.  For example,


 * $$\sum_{i=0}^{n-1} 2^i = 2^n - 1.$$


 * Whether such facts would warrant a separate article would depend upon how many and how important the properties. If not enough for their own article, they should probably be listed as a section in Power of two.—Anita5192 (talk) 17:35, 6 May 2019 (UTC)
 * Thx for the answers. Related topics

--Adam majewski (talk) 18:01, 6 May 2019 (UTC)
 * Mersenne primes
 * denominator of fraction is_of_the_form_(2^p_-1) - binary expansion

IMHO this topic belongs to binary number – surely $2^{p} − 1$ (and the respective 1…11 positional expansion) has applications in computer arithmetic. It is somewhat relevant to binary number and two's complement. Incnis Mrsi (talk) 18:59, 6 May 2019 (UTC)
 * Also one should note that its 2-adic limit is −1. Incnis Mrsi (talk) 19:03, 6 May 2019 (UTC)


 * According to OEIS they are "sometimes called Mersenne numbers, although that name is usually reserved for A001348 [those of the form 2^p -1]". Mathworld has a short article. AndrewWTaylor (talk) 08:38, 6 August 2021 (UTC)

Tebibyte etc.
240 bytes is known as either a terabyte or a tebibyte. Some argue that a terabyte is strictly 1012 bytes, and that 240 should be known only as a tebibyte. I think we should at least mention tebibyte, which some believe to be the only correct term for 240 and is generally accepted as at least a valid alternative. Storage manufacturers are particularly keen that terabyte should mean 1012, as this allows their quoted sizes to seem larger, and their antics do influence general usage. Can we include the terms tebibyte, pebibyte and exbibyte unlinked as a compromise? Certes (talk) 12:00, 28 February 2022 (UTC)