Infinity is a term with which most people are familiar, but few truly understand. Infinity is not an actual value, like the number 3 -- it is an abstract concept. In math terms, it is used as a "limit", where a value can approach infinity by getting continuously larger, but it will never actually get there. Consider the act of cutting a pizza into slices. You can cut it in half, then cut those halves in half, then cut those halves in half, etc. As the slices get smaller, the number of slices gets larger; therefore, as the size of each slice approaches zero, the number of slices approaches infinity. Again, in math terms, this means that as x approaches zero, the value of 1/x approaches infinity. Some go so far as to say that 1/0 equals infinity, but this would not be entirely correct; nothing can actually "equal" infinity, since it isn't a value, but an abstract limit that can only be "approached".
Here's another example. You are standing a...
read more

When using C++ for object-oriented programming, there are some basic concepts and best practices that should be followed for good software engineering. First is the use of public and private in class definitions. Most programmers moving from C to C++ are accustomed to using structs, where all fields are "public" for others to access; in C++, all fields in a class are "private" by default instead. There is a good reason for this: everything in a class should be private unless otherwise necessary. If there is some data that you wish to "expose", you are best off using getter/setter methods to do so rather than making the data public. If some other class needs direct access to the data, make it a "friend" class instead of making the data public. Be smart about which methods are made public as well, and limit the amount of exposure to the "internal workings" of your class.
Next is the use of "const",...
read more

A struct is a datatype from the C programming language that encapsulates a number of different datatypes into a single object. This can be used to easily handle a set of values as a single "package", while also being able to access the individual members of the structure. One example of this may be a ContactInfo structure that contains a person's first name, last name, e-mail address, phone number, birthday, etc.
It's easy to see how this would later be extended into the notion of a "class", where the object could have methods defined to access the data or otherwise manipulate its contents, and even lend its functionality to extensions that "inherit" from that type. C++ added this capability to the "struct" while also providing the more appropriate "class" keyword that does mostly the same thing (with some minor differences, such as the default access for members and methods for a class is private while it is public for...
read more

Here's an interesting math fact: the sum of any sequence of odd numbers from 1 to n is always a perfect square.
1 = 1
1+3 = 4
1+3+5 = 9
1+3+5+7 = 16
1+3+5+7+9 = 25
1+3+5+7+9+11 = 36
etc.
The sum is actually the square of (n+1)/2.
---------
What this also means is that every odd number can be expressed as a difference of consecutive squares:
1-0 = 1
4-1 = 3
9-4 = 5
16-9 = 7
25-16 = 9
36-25 = 11
etc.
In this case, each odd number n can be expressed as the square of (n+1)/2 minus the square of (n-1)/2.
---------
You can now use this knowledge to derive an infinite number of Pythagorean triples. For each odd number n greater than 1, these three values comprise a Pythagorean triple: n, (n^2-1)/2, (n^2+1)/2
3, 4, 5
5, 12, 13
7, 24, 25
9, 40, 41
11, 60, 61
13, 84, 85
etc.
Because of the relationship of the numbers,...
read more

Think of a number. Any number at all... between 10 and one billion.
Now, since that number has at least two digits, add up all of the digits, and subtract that sum from your original number.
Next, add up all of the digits of the number you just got after that subtraction, to get another new number. And then do it again with THAT number (if you have only a one-digit number, you would just get that same number again).
Finally, subtract 1 from that last number, and find the letter of the alphabet that corresponds to the result (1=A, 2=B, 3=C, etc.) Now think of one of the 50 United States that starts with that letter.
Aloha! You've just arrived in Hawaii, didn't you?
How does this work? The main "trick" to this is knowing that when a number is divisible by 9, the sum of its digits are also divisible by 9. Therefore, once you have a number that is divisible by 9, you can keep summing up the digits, and eventually end up with 9 as the final result. For a number...
read more

I'm about to share a secret with you that can instantly reduce the amount of time spent on math tests and homework where you need to find the greatest common factor (GCF) of two whole numbers, such as when reducing fractions to simplest form. This is a methodology/short-cut that I came up with long ago, but never saw described in any textbook, much to my surprise. The basic idea is actually quite simple:
Given two whole numbers A and B where A > B, the GCF of A and B must also be a factor of their difference: A-B.
Here's an example. You need to reduce the fraction 84/105 to simplest form. It might take you a minute or two to figure out all of the factors of these numbers, but you can get it by simply subtracting 105-84 = 21. The number 21 divides evenly into both 84 and 105, so that also happens to be the greatest common factor! Using this method, the final answer of 4/5 comes quickly and easily.
Just to be clear, the difference is not always the GCF, but the GCF is...
read more