quick squaring of numbers

I was lying awake last night, and a little math trick came to me.

Let’s say you want to know what 256*256 is. Normally, you might need to find a calculator or pen (or if you’re a geek, you already know the answer).

The steps you would usually follow to multiply this are:

  • 256*200=51200 (easy)
  • 256*50=12800 (easy)
  • 256*6=1536 (need memory)
  • 51200+12800+1536=65536 (need memory)

relatively easy, but you need to be able to remember some things.

An easier method might be:

  • 255*255=(25*26)+”25″=(625+25)+”25″=65025
  • (255*255)+(256*2-1)=65025+511=65536

So what did I just do? I just broke the problem down to take advantage of two math tricks.

The first is very simple – any number which has a 5 at the end, squared, is equal to the number without the five multiplied by itself+1, and “25” added to the end. For instance, in the above we have (25*26), which is equal to (25*25 +25). 25*25, using he trick, is equal to (2*3)+”25″, or 625, making 25*26=625+25=650. Easy!

the second has to do with how the result of every squared number ‘n’ is n*2-1 above the result for the square of n-1. For instance, if you know that 100 squared is 10,000, you can know immediately that 101 squared is 10,000+(101*2-1)=10201.

Little tricks, but they can be surprising to people that don’t know them.

You can also do the opposite – 99 squared is 100^2-(100*2-1)=9801.

The Strats

This post is not in any way technical – I’d just like to point people at the website of my friend Will Ludford’s band, The Strats. They’re a two-piece blues band with a sound like Dire Straits, Will on guitars, and Nigel Branigan on keyboards, who play their own music – in Will’s words, “I’ve got blues albums by people and I must have about forty versions of Hoochie Coochie Man and I just [don’t] want to do another one. I think people deserve a bit better”.

I must admit, I listened to their album once, and thought “it’s okay”, but after listening to it a few times, some bits just started sticking in my head, in that annoying “damnit, this is catchy!” way. In fact, I think I’ll turn off the Pachelbel I’m listening to, and play their album just one more time, to try exorcise Keeping My Eyes On You from my head.

I talked Will into placing a few of the songs online, so you can hear stuff from his album by using the MP3 player on the top left of the website (if you have flash installed). He’s also allowing those tunes to be downloaded freely, but I haven’t put those links up yet (they’re here).

Also, I talked him into lowering the price for a while on the album, for sales made through his site. Usually, the album sells for €15, but he’s selling them for €10 through his website. Seriously – listen to the stuff, then buy the album – what’s a tenner??

The Strats are primarily a gigging band, so if you like what you hear on the album, you’ll love seeing them live. If you want to know if they’re playing any time soon in your area, use the contact form on the website and ask them! They’re nice guys, and will answer directly.

If you like your guitar (and Will loves his Strats!), try this album out. Will worries that he doesn’t sing enough on the album – so? The guitar works, and that’s what matters!

this year so far

I’ve started teaching guitar. I think I have a pretty good method. My student is off work for about six weeks due to some back surgery, so I’ve made the assumption that he will have time to learn some theory, so I started off by explaining “power chords” (or “fifths” – made from the root note and the fifth note), and explaining how major and minor chords are made from the respective 1st, 3rd and 5th notes of the major scale (ionian mode) and minor scale (aeolian mode) from whichever root you want.

Instead of showing twenty open-string versions of chords and expecting to have to remind him of them all again the next week, I demonstrated only four chord shapes, A Am E and Em, and showed how barre chords can be used with those shapes to make any major or minor chord at all.

Hopefully, he has not run screaming for the hills already… I at least only show him songs he actually names himself. Last week, I showed him The Jam’s That’s Entertainment, and this week, I’ll be showing him Pink Floyd’s Wish You Were Here (which will be a handy introduction to open string chords G C and D, as well as hammer-ons and pull-offs).

On the work front, I’m currently working on some pretty significant improvements to our WebME engine‘s AJAX shopping cart. In the admin area, I’m working on allowing products to be created and dragged around categories as if they were files in a file manager. To manage this, I’ve ported my KFM project into WebME and converted the appropriate areas.

Robots… my mini-itx bot has served its purpose – I built it to see if I could, and I could, so it’s time to strip it down and reuse its parts for something else (files server, maybe). I’ll be building a few robots this year, using the Gumstix platform for the brain. This should allow for a much better battery life, as well as a much smaller body size.

We (Bronwyn and I) will be moving house this year. When we moved into our present house, we told the landlords that it would only be for a year or two while we looked for a permanent house to buy and live in. Bronwyn’s parents have given us an enormous boost in this – they found a two storey building with a converted attic, which is about the same size as our current cottage stacked on top of itself three times, and bought it for us. Of course, we’ll still need to pay off the mortgage, etc, but the gesture is definitely not unnoticed! Thanks, guys! More on that later, when details are more concrete.

My son is still a genius. Yesterday, at age 3.3, he wrote his name without prompting. He forgot the “T” in “JARETH”, but still – can your 3.3 year old son write his name? Of course, still not a word out of him yet, but he’s making progress in that as well – every night, he mumbles himself to sleep, trying out various sounds.

update: got a phone call earlier on to say that Bronwyn passed him while he was playing in the house, and she noticed he had written his name in total, not forgetting the “T”.

Boann is calming down a little – instead of screaming all day and night, she now only screams for a while, and I only spend an hour or so every night (usually some time between 1am and 3am) walking up and down wondering why she’s so wide awake at that unholy hour.

Life is getting slowly better.

I have a doctor’s appointment on Friday – I have a lump in a certain area since December, which may or may not be cancerous. We’ll see.

I emailed an old friend, who we had had a falling out with about seven years ago, over some stupid event that may or may not have happened when I was blind drunk after two bottles of vodka. He’s the piercer for a shop in Canada, and is apparently doing quite well for himself! Hi Andy! Bygones have become bygones, and hopefully, we’ll be able to sit down over a few jars at some point and laugh at ourselves.

Anyway… gotta get to work. It’s just past 9am, and I am officially into work-time now, so I’d better stop nattering.