Skip to content
February 4, 2012 / steve8

A quick look at pypy

As a lover of Python, I was excited to learn of efforts to make it run at speeds in the same class of C or Java.

Many programers consider python vs java as a battle of ease-of-programming vs speed…
Does pypy offer python programs the speed of statically typed languages?
Let’s throw a couple programs at it and see what happens:
Read more…

January 30, 2012 / steve8

Lost and Found: a log

0h25 on 1/28/2012: I step out of a taxi in Higienópolis in Sao Paulo to catch a late-night film…
note: SP has a metro population of 19.9 million humans.
0h26 on 1/28/2012: We realize the shopping center with the cinema is already closed, ruining our movie plans…
note: It’s raining, because that’s what it does in SP
0h27 on 1/28/2012: I realize my mobile phone (galaxy nexus) which I had in the cab, is no longer with me.
note: A Galaxy Nexus costs ~R$2000 ~= US$1140 here in Brasil
0h28 on 1/28/2012: I asked my friend about a cabbie lost and found with the police, but her semi-smile tells me all I need to know… Even if there was one, and the cabbie was an honest guy, why would he hand anything over to the police?
note: no one here seems to trust the police.
Read more…

January 27, 2012 / steve8

Try it: middle school math?

Laura is 3 times as old as Maria was when Laura was as old as Maria is now.
In 2 years Laura will be twice as old as Maria was 2 years ago.
How old are they now?

This is ripped from an Algebra 1 textbook used for 13 yr olds in the US.

April 7, 2011 / steve8

The New Look

This website runs on wordpress, always has.  I made the choice because the thought of writing a blog-like platform from scratch felt very daunting, and the vast library of plugins and themes available for wordpress made it seem like the obvious choice.  Indeed I was left impressed by the very easy installation and essentially turn-key setup.

Years later I can say the vast majority of the thousand or so themes have one of the following problems:

Read more…

March 31, 2011 / steve8

100,000 bits in space

The march 2011 ponder this puzzle was one of my favorites:

A spaceship has 100,000 bits of storage, and one of these bits is known to be faulty. You can locate the faulty bit using agents that run on any given subset of bits and return "OK" if all of the bits are good and die if they encounter the faulty bit. It takes an agent one hour to run a query, regardless of the size of the subset, but an infinite number of agents can run simultaneously. You need to find the wrong bit in two hours.
Since we must decide, in advance, how many agents to send with the spaceship, we are interested in the following questions:
A. What is the minimal number of agents needed? (Bonus question: Find a formula for the number of agents needed for n bits and t hours).
B. Suppose we want to send enough agents to be able to repeat the same task a second time with the remaining agents (i.e., those who did not die during the first invocation). How many agents are needed in that scenario?
Update March 2nd: Different agents can access the same memory bit at the same time.

I’ve written up a handful of these ponder-this puzzles and continue to see value in doing so, not just for my own record, but also to help people get better at problem solving.  I do this knowing that the ponder-this people publish a solution (which I’ve appended to this post), because the expanded path that I walk through is more helpful to those who might have problems, and it shows what I think is an honest look at what goes into understanding these things.

I do Strongly suggest trying the puzzle for yourself before reading my solution.

Enough with the prologue, let’s start:

Read more…

March 10, 2011 / steve8

Number in a haystack

 

Last month’s ponder-this puzzle caught my eye, so I decided to give it a whirl.

in short, its to find an integer n which has 3 properties:

A: n is flippable and flip( n) = n

B: n*n is flippable

C: n is divisible by 2011

where the flip of an integer, is the number that appears when the decimal representation in old style 7-segment font is rotated 180 degrees.

I will walk through how my solution evolved.

Read more…

October 21, 2010 / steve8

Qualitative Comparison of UltraPortable Laptop Designs

Anyone who knows me, knows I value efficiency.  Efficiency with space, weight, and energy.

I’ve been generally unhappy with the laptop choices recently and was curious to see what apple would do to their macbook airs.

 

Apple seems to be the only company who can take a step back and try to design an ideal product, rather than tweak the same design over and over again.

 

What is the perfect ultra portable laptop?

  1. The entire area of the screen-face should be used for display, no wasted area. (the 11.6” air could actually have a 14” screen without the wasted border area)
  2. thickness should be nearly zero
  3. full-size keyboard, and uncompromised pointing/gesturing.
  4. highest performance per watts
  5. no noticeable noise
  6. no noticeable heat
  7. low risk of damage/wear
  8. Assuming battery capacity costs mass, all other masses should be trivial to minimize weight.

 

The major step apple took with their new ultraportable is enclosure-less solid state storage, this kind of solution was marketed at ultra-low-cost products by SanDisk not including an enclosure is a way to save pennies, just like smaller cars in the 80s/90s in the US, are for those who can’t afford more.

Read more…

May 11, 2010 / steve8

Another Fun Puzzle

The prime number 4535653, when translated to base 16, gives the hexadecimal number 0x453565, which has the same digits as the original number, omitting the last digit.

Find another example of a prime number that, translated to hexadecimal, yields the same digits, omitting the last 21 digits

This was the Ponder This Challenge for April 2010.

 

It relies on positional base numeral systems which are widely used and rarely thought about in our culture.

Read more…

April 24, 2010 / steve8

Buying an LCD Display

I decided I wanted a 24” display, so i did a little searching.

I settled on the HP ZR24w, as it was an IPS panel with good colors and viewing angles (IPS panel), had very little input lag, could rotate for 16:10 or 10:16 use, and wasn’t ridiculously priced like most IPS panels.

on HP’s page they are boasting a lot of energy saving stuff like an 85% power supply.  But forgive me for not really trusting their energy-efficient marketing, so I started comparing some LCD power consumption and found some striking differences.  Take a look at the little table I constructed:

 

 

other sources:

energystar, cnet, apple

 

What a wide range of power consumption, even at the same brightness.  There are no sanely-priced efficient IPS-panel 24-inch displays.  On this data it seems LEDs use less energy (no surprise), but maybe IPS panels need more power than tn?  I say that because the apple display is LED and IPS and still guzzles watts (oddly even more than the dell IPS ccfl display).

March 15, 2010 / steve8

Factoring Algorithm puzzle

What is the minimal number, X, of yes/no questions needed to find the smallest positive integer divisor (other than 1) of an integer between 2 and 166 (inclusive)?

We are asking for the exact answer in two cases:

  1. In the worst case, i.e., what is the smallest number X for which we can guarantee finding it in no more than X questions.
  2. On average, i.e., assuming that the number was chosen in uniform distribution from 2 to 166 and we want to minimize the expected number of questions.

This problem was IBM’s Ponder This puzzle of November 2009.

I’m going to write my solution in English, along with code (both python and java) so anyone knowing any one of the 3 languages should be able to follow along.

Read more…