Exciting coincidence!

California’s license-plate scheme is

digit-letter-letter-letter-digit-digit-digit

We can consider this as a number written with one base-10 digit followed by three base-26 digits (where A is 0, B is 1, C is 2, etc.) followed by three more base-10 digits. It’s easy to convert such a sequence to a pure base-10 number. For instance, 0AAA000 is 0. 0AAA001 is 1. 0AAA002 is 2. And so on up through 0AAA999, which is 999, and then to 0AAB000, which is 1,000. 0AAC000 is 2,000. 0AAZ000 is 25,000. 0AAZ999 is 25,999, and 0ABA000 is 26,000. And so on.

Here is a short Python function that does the conversion:

def plate_to_number(sequence):
  result = 0
  for character in sequence:
    if character.isdigit():
      result = result * 10 + int(character)
    elif character.isalpha():
      character = character.lower()
      result = result * 26 + (ord(character) - ord('a'))
  return result

My first license plate on moving to California in 1992 was 2ZZZ923, whose number value is 52,727,923. Now here’s the exciting coincidence: the number value of my current license plate, from 2007, is almost exactly double that (to within an error of 0.014%)!

Well, it’s exciting to nerds.

Have you herd?

[Cross-posted at facebook.com/bob.glickstein/posts/10151865534302377.]

Suppose there’s a disease that has a 50% chance of infecting you if you come into contact with it. Now suppose you come into contact with 10 people in one day. On average, 5 of them will be carrying the disease. Your odds of avoiding the disease are 50%×50%×50%×50%×50%, which is about 3%. In other words, you have a 97% chance of contracting it.

Now suppose you – and only you – get vaccinated. Let’s say it reduces your odds of infection, when exposed, from 50% down to 10%. Since no one else is vaccinated, when you come into contact with 10 people, it’s still the case that 5 are infected. Your odds of avoiding the disease are now 90%×90%×90%×90%×90%, or 59%. There is a 41% chance you’ll get sick. That’s a big improvement compared to 97%, but we can do a lot better.

Now suppose everyone gets vaccinated. Of the 10 people you come into contact with, on average only 1 will be infected. Your odds of getting sick are now only 10%.

That is the power of herd immunity.

64+8+2+1

We had no room on Dad’s birthday cake for 75 candles. But who needs 75 when you know binary?

Hung up

Men, if your penis is of average size or slightly above, and you’ve taken solace (while watching some well-hung stud in a porn film) in the thought that most other men are your size or smaller, mathematics and I are here to ruin your whole day.

After all, it’s not some hypothetical matchup against all other men that you’re interested in, is it? If you’re honest with yourself, what you really care about is whether yours is the biggest dick your partner’s ever had. And that’s where the bad news begins.

Suppose your size is exactly average; that you’re in the 50th percentile for penis length. That means that 50% of men are smaller than you, and 50% are bigger. Does this mean you have a fifty-fifty chance of blowing your lover’s mind? Only if your partner had one man before you. If your partner had two men before you, the odds of their both being smaller are 0.5×0.5, or 25%. If three, the odds they were all smaller are 0.5×0.5×0.5, or 12.5%. In other words, there’s an 87.5% chance — 7 chances in 8 — they’ve seen bigger.

Let’s say you’re one of the lucky ones in the 75th percentile. Your dick is bigger than that of three out of every four men you see. There’s still a 58% chance that your partner (who’s had three men before you) has seen bigger!

In order to have an even chance of having the biggest dick that a partner with three previous lovers has ever seen, you have to be in the 80th percentile for penis size (about 6.25 inches according to the condom manufacturer LifeStyles). But that’s just an even chance. To have a good chance — say, 90% — you have to be in the 97th percentile (about 7.5 inches). And that’s if your partner has had only 3 men before you. It’s not too unusual to be the fifth or tenth or twentieth man, especially of a partner who’s very desirable.

None of these numbers mean anything if you can’t get it up when the time comes, so now that I’ve given you the bad news — don’t think about it.

Fit-ness

Survival of the “Fit”test

A lower price wasn’t the Fit’s only advantage over the Prius. While car shopping I rented a Prius for a one-day extended test drive, ending up with three specific complaints:

  1. Visibility through the rear window is poor;
  2. The console’s large, animated engine-performance display is dangerously distracting;
  3. The keyless engine-start button is (a) unsafe with small children around but (b) too cool to disable with the child-safety lock.

More than a year ago I replaced my 1998 Honda Civic hatchback with a new Honda Fit. Fuel efficiency was a key decision criterion for me, and naturally I considered the Toyota Prius; but the Prius gets its best gas mileage in city driving, and at the time of my purchase most of my driving was on the highway, where the Fit’s efficiency was close to that of the Prius, at a much lower price.

I’ve been tracking my Fit’s fuel consumption on a spreadsheet for several months now and the trend is clear: its efficiency is consistently in the 35 MPG range. Nothing to sneeze at, especially given the dismal fuel economy of almost all other cars on the market; but disappointingly it falls short of the mileage I was getting with my Civic at the end, which occasionally exceeded 40 MPG — with the previous decade’s engine technology!

You can see the mileage I’m getting, fill-up-by-fill-up, in my Google Docs spreadsheet.

What are the odds?

Our PlayStation 3 is not just a gaming console; it is our entire living room entertainment delivery system. It has replaced our DVD and CD players, and with its front-facing USB port I don’t even need CD’s; I just load up a thumb drive with music, plug it in, and play.

I have a thousand songs on one of those thumb drives, and I always play them in “shuffle” mode. Yet it seems that there is always a lot of overlap between one listening session and another — the same songs that I heard yesterday are in today’s mix. You’d think that with a thousand songs to choose from, it would be a while before I hear the same song twice, unless there’s something not sufficiently random about the PlayStation’s song randomizer.

I was all prepared to fire off an indignant letter to Sony’s customer support department when I decided I first needed to understand exactly how unlikely was the overlap I was encountering.

Figure that a “listening session” includes twenty songs. There are 339,482,811,302,457,603,895,512,614,793,686,020,778,700 (339 duodecillion) different ways to choose twenty songs from a collection of a thousand. This result is given by the combinatorial formula:

n! / k!(n-k)!

where n is the number of items to choose from (1,000, in this case), k is the number of items to choose (20), and “!” is the “factorial” operator that means “multiply the preceding number by every other number between it and 1.” Five factorial, for instance, is written “5!” and is equal to 5×4×3×2×1, which is 120.

The combinatorial formula above is sometimes abbreviated “nCk,” pronounced “n choose k.” The very very big number is the result of calculating 1000 C 20.

So there is a vast number of possible listening sessions. But in how many ways can one listening session overlap with another? Let’s consider a second listening session that doesn’t overlap at all with the first. The way to think about this is that the first listening session “used up” twenty of the available songs, leaving 980 to choose from — specifically, 980 from which to choose 20, or 980 C 20, which is 225,752,650,356,644,030,123,857,337,771,499,346,518,885 (225 duodecillion).

So of the 339 duodecillion ways to choose 20 songs from a thousand, 225 duodecillion, or 66%, do not overlap — but that means that 34% do overlap. There is a one-in-three chance that at least one song in the second session will be the same as one in the first.

This was a stunning result to me. I never expected the odds of an overlap to be so high.

That doesn’t mean that the PlayStation is working correctly, necessarily; it’s my impression that I’m getting multiple-song overlaps, and I’m getting them much more than one-third of the time, so the PlayStation still may not be adequately randomizing its playlist. But this result does send me back to the drawing board to gather objective data about just how much overlap I am getting.

To the nerdth power

Nerd confession: I just realized that my son Archer, who is 4, and my stepdaughter Pamela, who just turned 27, both have ages that can be expressed in the form nn — Archer is 22 and Pamela is 33. Barring a major advance in gerontology research I regret to say it is unlikely any of us will ever see 44.

(Didn’t know that I had an adult stepdaughter? I haven’t mentioned her here before, but we added her to the cast a couple of seasons ago in a Cousin Oliver moment to boost our sagging ratings.)

Update: Oh drat, Pamela’s 26, not 27. What’s interesting about the relationship between her age and Archer’s now? Umm… Archer’s is the number of suits in a deck of playing cards, and Pamela’s is the number of red (or black) cards? Sorry, that’s the best I’ve got.

At this rate…

How do you like that — the same weekend that my blog turned two years old, my Google AdSense account — the little kickbacks I get every time one of you clicks on the ads that appear next to one of these posts — also passed a major milestone: I’ve earned ten dollars! At this rate I’ll be able to retire, when the time comes, on over one hundred AdSense dollars!

Come to think of it, that’s only if you consider my mounting AdSense balance to be an arithmetic progression. On the other hand, ten dollars is a thousandfold increase over my balance the last time I reported it almost two years ago. With just two data samples it’s impossible to tell whether the progression is arithmetic or geometric. If the latter, then my balance has been growing at better than 1% per day. At that rate, by the time I retire you will all bow before benevolent supreme dictator Bob and his 8.7 duodecillion dollars, mwa ha ha ha ha ha! Even if the dollar collapses, that oughta be worth something on eBay. Thanks, AdSense!

T minus 100

It’s 100 days until my birthday! (And how cool that the hundredth day before my birthday is Bastille Day! Well, it’s a little cool. Oh, OK, it’s a meaningless coincidence.)

To goose my weight-loss regime, which appears to have stalled once again — though I am holding my own against the “Google 15” — I am adding a daily exercise regimen for the first time, inspired by hundredpushups.com: each day I will do one more push-up than the day before, starting with one today and culminating with a hundred push-ups by my birthday.

If I keep exactly to that plan, the total number of push-ups I’ll do is 5,050 — one today, two tomorrow, three on Wednesday, four on Thursday, and so on. The sum of the first N numbers from 1 through N is, in general,

(N+1) × N/2

an elegant intuitive proof of which is as follows. List the first N numbers, let’s say 6 for this example:

1 2 3 4 5 6

The sum of the two “outer” numbers is 7:

1 2 3 4 5 6

Removing those, the sum of the next two “outer” numbers is also 7:

2 3 4 5

Removing those, the sum of the final pair is also 7:

3 4

That sum — N+1 — is repeated N/2 times, giving rise to the formula

(N+1) × N/2

“Wait a minute,” I hear you say. “What about when N is odd? Then there’s one extra innermost number with no partner.” That’s true. In that case, the number of pairs that add up to N+1 isn’t N/2, it’s only (N-1)/2:

1 2 3 4 5 6 7

Here N is 7, and there are 3 pairs that add up to 8 — 1 and 7, 2 and 6, 3 and 5 — and 4 is all alone in middle. So the sum is:

(N+1) × (N-1)/2 + the middle number

But the middle number is always (N+1)/2, so this becomes:

(N+1) × (N-1)/2 + (N+1)/2

which is the same as

(N+1)/2 × (N-1) + (N+1)/2

which can be read as adding one more (N+1)/2 to a collection of N-1 of them, for a total of N (N+1)/2’s:

(N+1)/2 × N

which is the same as

(N+1) × N/2

which is the same as the original formula above whether N is odd or even. QED.

OK, let’s get this regimen started. Rrrrrnnnnngghh — one. Whew.