Click here to send us your inquires or call (852) 36130518

Sunday, October 28, 2007

Prime Motivation

2300 years ago, Euclid was able to prove that there were an infinite number of prime numbers [1]. This was thousands of years before steam engines, before knowing what gravity is, before knowing what the Sun is, before knowing that disease is caused by microscopic animals and viruses. Modern knowledge of mathematics far predates its application. The ancient Greeks like Euclid were cutting edge mathematicians, "[they] first spoke a language which modern mathematicians can understand." [2]

To prove primes are infinite, Euclid chose to disprove the opposite: that primes are finite. It's a really simple proof:


  1. Assume that prime numbers are finite and that "P" is the largest prime. For the sake of example, let's say the largest prime number is P = 7. That would mean that 2, 3, 5, and 7 are the only prime numbers, and 7 is the largest of them; that there are no prime numbers bigger than 7.
  2. Create a new number, "Q", by multiplying all the known primes together, and adding "1". e.g. Q = (2 * 3 * 5 * 7) +1 = 211
  3. Divide Q by any of the known prime numbers. It will never divide evenly and always have a remainder of "1". e.g. 211/2 = 105R1, 211/3 = 70R1, 211/5 = 42R1, and 211/7 = 30R1
  4. If a number is indivisible by any primes, that means that it, itself, is a prime number.
  5. P = 7 cannot be the largest prime because Q = 211 is larger than P and is prime. This is true for any value of P.
  6. Therefore, there cannot be a largest prime. Reductio Ad absurdum, our initial assumption that there can be a "largest" prime is incorrect. The prime numbers go on forever.
If there's an infinite number of primes, there's not much point in trying to enumerate all of them, but it feels like we should be getting less and less of them as we count higher and higher. That is, more or less, what happens. The Prime number theorem (2nd link to more rigorous explanation, 3rd link for emprical findings) gives us an asymptotic logarithmic distribution of prime numbers. The larger the number is, the smaller the chance it's going to be a prime number.

Another interesting feature of the landscape of prime numbers is an Ulam spiral. If you plot them just right, the spacial distribution of prime numbers has a pattern detectable by humans with the naked eye.


To get the pattern shown above, list numbers sequentially in a square-spiral way and plot a point at each prime number you find. [3] This pattern was discovered by accident by a doodling mathematician (Stanislaw Ulam) in an allegedly boring meeting.

The late mathematician Paul Erdos is reported to have said "God may not play dice with the universe, but something strange is going on with the prime numbers."

Strange, indeed.

Burton MacKenZie /

[1] "Elements IX 20. The real origin of many theorems in the Elements is obscure, but there seems to be no particular reason for supposing that this one is not Euclid's own", G.H.Hardy, "A Mathematician's Apology", Cambridge University Press, 1940, p. 92.

[2] G.H.Hardy, "A Mathematician's Apology", Cambridge University Press, 1940, p.81.




[3] Licensed under the GFDL by the original author; Released under the GNU Free Documentation License.

Thursday, October 18, 2007

Dying to Win the Lottery

Lotteries give some people hope that they will escape their existing financial life and become millionaires. One of the older lotteries in Canada is Lotto 6/49, where for two bucks ($2) you can win as much as 54.3 Million Dollars! (a record jackpot from 2005)

The chances of winning in Lotto 6/49 is one in 13,983,816, or almost 14 million. Most people, including me, don't have a good visceral feel for how big a number that really is, or what kind of odds those really are. When a city bus was recently barreling down on me, I thought of a way to put it in perspective: your chance of winning versus your chance of dying.

Working with the latest data from Statistics Canada, Canada's population in 2006 was 32,623,500 people. The death rate was 237,931 in a 2006/2007 evaluation year. That means that roughly 1 in every 140 people in Canada die every year. That's pretty good odds.

Scaling the odds of death in Canada to a one-week basis, that is 4563 people dying every week. Your chance (if you're in Canada) of one of those people being YOU is 1 in 7149.

To put this in perspective, if you buy a weekly ticket for the lottery, the chances of you dying by the end of the week are almost 2000 times higher than the chances of you winning! (1956x higher)

You may not live in Canada, you may not play Lotto 6/49, but if you're playing the lottery, your chances probably aren't much different.

Burton MacKenZie www.burtonmackenzie.com

Saturday, October 13, 2007

Shawn Frayne's new invention, the WindBelt, is an interesting new small-scale wind-power generation technology! Instead of generation by mechanical rotation (classic generator), it generates power by magnets mounted on an oscillating linear ribbon. It could be a good contributing member in a robust, distributed power grid.

A limitation with classic wind power generation is scale. It's hard to make a useful small wind generator. The larger a wind generator blade is, the more power it can provide. The power available goes up proportionately with the amount of area swept by the blade(s), or the square of the radial length of the blade which sweeps out a circle. That's great if we can build bigger generators, but if we decrease the length of the blade, it works against us. For instance, if you were generating approximately 550 Wh/day with a 1-metre blade generator in a low wind (4.5m/s) area, a 10-cm blade (the size of a table fan) would only generate approximately 5.5 Wh/day [1]. That's a drop of 100x in power for a 10x drop in blade size. It's not generating a lot.

To further complicate impracticality of small size, all of the current wind generators suffer from friction losses. At large power generation amounts, these losses are small (or rather, not enough to stop the blades), but it dominates more the smaller you get. A classical model of friction is a force opposing the direction of movement linearly proportional to any applied force. The wind driving force is proportional to the power being generated, which is proportional to the square of the size of the blade.

The net Force is going to be


Fw = Force due to wind
Ff = Force due to friction
Ff = k*Fw
k = coefficient of kinetic friction (0 < k <= 1)
r = radial length of blade
~ = "proportional to"

F = Fw - Ff
= Fw - k*Fw
= Fw (1-k)
~ (1-k)* r*r

Note that friction lowers the magnitude of the coefficient of the squared term. Its power-term slope is smaller, or doesn't rise as sharply.

Further, the power generated (and hence, the force) is proportional to the square of the windspeed. While moving, the force lost due to friction may be small, but the speed at which it stays kinetic has a floor value. That is, if the blades slow down too much, the blades will stop and be ruled by the coefficient of static friction, which is much higher, or rather, exactly enough to prevent motion.

This means that, given a relative constancy in the coefficient of kinetic friction in the generator with variant blade size, a smaller blade length will result in the blades stopping rotation more often due to friction, which translates to even less overall power generated.

All that was to say that tabletop wind generators are not especially practical.

By contrast, the WindBelt claims to be able to generate 40mW in 4.5 m/s wind, which is almost 1Wh/day. They also claim to be 10 to 30 times more efficient than equivalent microturbines. If I extrapolate (unfortunately likely into a nonlinear region) from the tables in my reference book [1] for the given wind speed (at which the WindBelt was tested, 4.5m/s), which says a 1m blade will generate ~548 Wh/day, the new would be approximately equivalent to a rotor blade length of 4.8 cm (given +30% efficiency). However, I doubt my extrapolation is accurate due to the non-linear nature of the static/kinetic coefficient boundary and that of the squared radial term - I find it hard to believe that a 5cm blade wind generator (especially under electrical load) would do anything at all in a 4.5 m/s wind. Remember, the Force is also proportional to the square of the windspeed, so the 5cm blade might not be getting enough force applied to it to overcome friction in the first place.

Unfortunately, the popular mechanics article doesn't give any dimensions of the unit tested that gave those results, so we're comparing apples to phantoms. I'd also like to know how its power generation scales with the length and width of its ribbon.

The power in the wind is fixed; that is, there is a maximum amount of power you can extract from it. This device isn't a cure-all for mankind's large magnitude power consumption needs (for example, Las Vegas). What it does do is allows people take more efficiently extract power in low windspeed situations. It would be an excellent trickle charger for batteries. It can be simply manufactured and likely will be significantly cheaper than a rotational generator. Essentially, it is a cheap energy generation device that can be placed anywhere. I hope it scales well.

Burton MacKenZie www.burtonmackenzie.com

[1] Stats generated from wind generation power tables (with total efficiency listed as 0.28) in "Wind Power for Home and Business", Paul Gipe, Chelsea Green Publishing Company, 1993

Monday, October 08, 2007

Archimedes was in the news again this weekend when a part of a palimpsest was recovered showing that he was working on what would be the fundamentals of calculus 2200 years ago, almost 2000 years before Newton or Leibniz!

I can't recall if it was the mathematician Hardy or Chaitin who said something like (paraphrased) "the ancient Greek mathematicians weren't naive mathematicians, they are our fraternal brothers from another school". [Update: 1]

I'm starting to wonder if the ancient Greeks weren't right about the non-existence of irrational numbers in a physical universe. An infinite set is basically one which contains an infinite subset of itself which is equally numerable. (e.g. integers and integer squares) If the universe isn't infinite in some way, either infinitely unbound or infinitesimally divisible, irrational reals can only be asymptotic limits. For instance, if you made a physical 2D "circle" out of 11 discrete balls (a 2-3-4-3-2 stack) - any possible measurement of pi for that "circle" would be approximately 3 at that resolution. That is, any finite physical implementation of a circle can only finitely represent the infinitely long transcendent irrational number pi. It doesn't matter if pi is represented in 8 bits or 8 kagillion bits that fill an entire finite universe, it's still a finite number that has a calculable roundoff error from its irrational asymptote.

Then again, maybe the universe is infinite (I don't think there is any hard data either way, yet). If that's the case, then we don't have to lie awake at night wondering if the roots of prime numbers, pi, or e actually exist or are simply a human construction. That's a whole other ball of wax, and would probably be enough to convince me true randomness can exist. It will also mean a box can be exactly twice the volume of another box, and that's gonna be a tough pill to swallow.

Burton MacKenZie /

[1] Update: It was Hardy reporting on what Littlewood once said to him, "[the ancient Greeks] are not clever schoolboys or 'scholarship candidates', but 'Fellows of another college'". Taken from "A Mathematician's Apology", G.H.Hardy, Cambridge University Press, 1940, p.81.

Wednesday, October 03, 2007

Here's a mathematical "trick" for multiplying some numbers in your head that a friend showed me the other day. It uses an algebraic difference of squares. It's a little reminiscent of my earlier post of How to Multiply numbers near 100 quickly in your head.

First, an example: Let's say you want to multiply 95 x 105. In my head, I could think, "OK, that's 100^2 - 5^2, which is 10000 - 25 = 9975", and 9975 is the correct answer. Now how did I do that?

In algebra, a difference of squares is an expression that takes the form of:

x^2 - a^2

which has the factors

(x - a)*(x + a)

(Multiply out these two factors and you'll get the difference of squares, above)

Look at the example numbers I gave, 95 and 105. Those numbers can be rewritten in the form:

(100 - 5)*(100 + 5)

which correspond directly to the factors of the difference of squares. (That is, let x=100, a=5) That means that I can also represent the same multiplication in the difference of squares form:

100^2 - 5^2 = 10000 - 25 = 9975

The ease of this method relies on you being able to do squares of the numbers involved, but it works for any two numbers you can choose, as you only need to find the midpoint around which each value is radially symmetric.

Here's another example: What's 15 x 17?

15 x 17 = (16 - 1)*(16 + 1) = 16^2 - 1^2 = 256 - 1 = 255.

Not impressed yet? What's 264 x 248?

264 x 248 = (256 + 8)*(256 - 8) = 256^2 - 8^2 = 65536 - 64 = 65472.

It really helps, of course, to know a bunch of squares of integers. The ones I provided in example here are ones that tech people usually know. A lot of people know the squares of numbers from 1 to 10 or 16, which still makes this technique useful. Your mileage may vary.

This also comes in handy when used in conjunction with other tricks, like How to Square Integers near 50 in your head and How to Square Numbers ending in a 5 in your head. Get enough of these tricks in your head and people will think you're a superhuman calculator, but remember, as Spiderman said, "With great power comes great responsibility". Use it wisely.

Burton MacKenZie www.burtonmackenzie.com