Fred Brooks wrote The Mythical Man-Month, and was recently interviewed by Wired.
Brooks: You can learn more from failure than success. In failure you’re forced to find out what part did not work. But in success you can believe everything you did was great, when in fact some parts may not have worked at all. Failure forces you to face reality.
Friday, July 30, 2010
Article on Divorce
This is a link to an article by David Code, with some thoughtful insights on why destructive dynamics can develop in relationships.
Thursday, July 29, 2010
How to earn the right to be heard
[H]ere's a quick list of a few ways to earn that right:
Be informed
Be rational
Pay your dues
Have a platform where a lot of people can hear you
Be an impacted constituent, not a gadfly
Represent a tribe of people with similar concerns
You've been right before
You're not anonymous
You have a previous relationship and permission to interrupt
Listening to you earns something of value
From Seth Godin
Tuesday, July 27, 2010
Tamar Gendler discusses her work
Yale Class of 1987: Tamar Gendler discusses her work on bloggingheads....: " Tamar Gendler was recently on a blog/tv broadcast discussing some of her work.
Interesting Labor Statistic from Robert Reich
52,000 GM hourly workers remain in the United States – down from 468,000 in 1970.
From Robert Reich's blog article, The Great Decoupling of corporate profits from jobs.
From Robert Reich's blog article, The Great Decoupling of corporate profits from jobs.
Marathon Week 2
Week 2: so far, so good, althought I've already rearranged a few days. I try not to get all rigid about the workouts midweek because they seem fairly interchangable. M -- 3 mile run instead of resting, T -- 2.5 mile walk. W- off. If I do 3 mi runs on Th & Fri, I'll be back on schedule.
I was worried about the six-miler last Saturday, but it ended up being less of a problem than I had feared, esp. sore ankles.
I was worried about the six-miler last Saturday, but it ended up being less of a problem than I had feared, esp. sore ankles.
Friday, July 23, 2010
Rules for Conversations -- active listening
From Scott Adams, author of the Dilbert comic strip.
1. The more dangerous or inappropriate the conversation, the more interesting it is.
2. Conversations about how people have or will interact are interesting, and conversations about objects are dull.
1. The more dangerous or inappropriate the conversation, the more interesting it is.
2. Conversations about how people have or will interact are interesting, and conversations about objects are dull.
Thursday, July 22, 2010
Tuesday, July 20, 2010
The problem with A/B Testing
Blog post from Jeff Atwood about how marketing studies don't create campaigns, they can only fine tune them. Excellent use of a movie reference to "Groundhog Day," as a way to make this point. Sample quote:
That's the problem with A/B testing. It's empty. It has no feeling, no empathy, and at worst, it's dishonest. As my friend Nathan Bowers said:
A/B testing is like sandpaper. You can use it to smooth out details, but you can't actually create anything with it.
That's the problem with A/B testing. It's empty. It has no feeling, no empathy, and at worst, it's dishonest. As my friend Nathan Bowers said:
A/B testing is like sandpaper. You can use it to smooth out details, but you can't actually create anything with it.
Great thought experiment from For the Win
Cory Doctorow's latest work, For the Win, is not just for teenagers. Here's an example of the kind of thought experiment he presents:
You're in a strange town, or a strange part of town. A little disoriented already, that's key. Maybe it's just a strange time to be out, first thing in the morning in the business district, or very late at night in clubland, or the middle of the day in the suburbs, and no one else is around.
A stranger approaches you. He's well-dressed, smiling. His body-language says, *I am a friend, and I'm slightly out of place, too.* He's holding something. It's a pane of glass, large, fragile, the size of a road atlas or a Monopoly board. He's struggling with it. It's heavy? Slippery? As he gets closer, he says, with a note of self-awareness at the absurdity of this all, "Can you please hold this for a second?" He sounds a little desperate too, like he's about to drop it.
You take hold of it. Fragile. Large. Heavy. Very awkward.
And, still smiling, the stranger methodically and quickly plunges his hands into your pockets and begins to transfer your keys, wallet and cash into his own pockets. He never breaks eye-contact in the ten or 15 seconds it takes him to accomplish the task, and then he turns on his heel and walks away (he doesn't run, that's important) very quickly, for a dozen steps, and *then* he breaks into a wind-sprint of a run, powering up like Daffy Duck splitting on Elmer Fudd.
You're still holding onto the pane of glass.
Why are you holding onto that pane of glass?
What else are you going to do with it? Drop it and let it break on the strange pavement? Set it down carefully?
Tell you one thing you're not going to do. You're not going to run with it. Running with a ten kilo slab of sharp-edged glass in your hands is even dumber than taking hold of it in the first place.
You're in a strange town, or a strange part of town. A little disoriented already, that's key. Maybe it's just a strange time to be out, first thing in the morning in the business district, or very late at night in clubland, or the middle of the day in the suburbs, and no one else is around.
A stranger approaches you. He's well-dressed, smiling. His body-language says, *I am a friend, and I'm slightly out of place, too.* He's holding something. It's a pane of glass, large, fragile, the size of a road atlas or a Monopoly board. He's struggling with it. It's heavy? Slippery? As he gets closer, he says, with a note of self-awareness at the absurdity of this all, "Can you please hold this for a second?" He sounds a little desperate too, like he's about to drop it.
You take hold of it. Fragile. Large. Heavy. Very awkward.
And, still smiling, the stranger methodically and quickly plunges his hands into your pockets and begins to transfer your keys, wallet and cash into his own pockets. He never breaks eye-contact in the ten or 15 seconds it takes him to accomplish the task, and then he turns on his heel and walks away (he doesn't run, that's important) very quickly, for a dozen steps, and *then* he breaks into a wind-sprint of a run, powering up like Daffy Duck splitting on Elmer Fudd.
You're still holding onto the pane of glass.
Why are you holding onto that pane of glass?
What else are you going to do with it? Drop it and let it break on the strange pavement? Set it down carefully?
Tell you one thing you're not going to do. You're not going to run with it. Running with a ten kilo slab of sharp-edged glass in your hands is even dumber than taking hold of it in the first place.
Hal Higdon Marathon Training Week 1
We'll see if I can stick with it without getting injured. Based on a better-then-expected (sub 8 min) time in the Petit Road Race, I decided to take a stab at a marathon. Don't know which one I'll do yet, because there are so many weeks and chances to get injured between now and the end of the 18 week program, but it does lead right up to high season for marathons in the late fall. Expect weekly updates from the Hal Higdon program.
Monday, July 19, 2010
Ironic blog post
Friday, July 16, 2010
Wednesday, July 14, 2010
Quote of the Day
Isaac Asimov:
The most exciting phrase to hear in science, the one that heralds new discoveries, is not 'Eureka!' but 'That's funny...'
The most exciting phrase to hear in science, the one that heralds new discoveries, is not 'Eureka!' but 'That's funny...'
Tuesday, July 13, 2010
Monday, July 12, 2010
Mark Twain Essay
Concerning the Interview:
No one likes to be interviewed, and yet no one likes to say no; for interviewers are courteous and gentle-mannered, even when they come to destroy.
No one likes to be interviewed, and yet no one likes to say no; for interviewers are courteous and gentle-mannered, even when they come to destroy.
We will pay you $4.00 for One Hour of Your Time
The Classified ad that changed the world.
PTSD Therapy bills not included. Thanks, Stanley Milgram.
PTSD Therapy bills not included. Thanks, Stanley Milgram.
Commandments of Management
Excerpted from the NCO Creed.
1. The two basic responsibilities are "accomplish the mission" and "look after my people"
2. I will strive to remain technically and tactically proficient
3. All employees are entitled to outstanding leadership; I will provide that leadership
4. I will be fair and impartial when recommending both rewards and punishment
5. Superiors will have maximum time to accomplish their duties; they will not have to accomplish mine
6. I will exercise initiative by taking appropriate action in the absence of orders
7. I will not compromise my integrity, nor my moral courage
1. The two basic responsibilities are "accomplish the mission" and "look after my people"
2. I will strive to remain technically and tactically proficient
3. All employees are entitled to outstanding leadership; I will provide that leadership
4. I will be fair and impartial when recommending both rewards and punishment
5. Superiors will have maximum time to accomplish their duties; they will not have to accomplish mine
6. I will exercise initiative by taking appropriate action in the absence of orders
7. I will not compromise my integrity, nor my moral courage
Thursday, July 8, 2010
Maybe I don't need to take Chinese After All . . . .
From Stratfor Editor interviewed in Yale's SOM bulletin.
Q: China is described in the book as a paper tiger. Why do you come to this conclusion?
China is 1.3 billion people. According to Chinese government statistics, 600 million of those people have a total household income of $3 a day or less. Another 440 million earn between $3 and $6 a day. What we would call middle class, people with a household income of $20,000 and above, account for only 60 million people in China. That's still comparable to a large country, like France, but it represents less than 5% of the Chinese population. China is an extraordinarily poor country. Most business people travel to that small part of China that contains the tiny middle class. And they extrapolate from that.
You always have to remember that China can't sell electronics or toys to people earning $2 or $3 a day. They have to sell those goods to the advanced industrial world. And if the advanced industrial world isn't buying, China is in tremendous trouble. When the United States or Europe stops consuming as much as they did before, you’re dealing with unemployment in a country where unemployment can yield malnutrition. What we're seeing right now is China introducing a massive security crackdown to try to control a situation of enormous unhappiness in China.
China is also holding extremely large dollar reserves. Japan in 1990 and the United States in 1929 held massive foreign currency reserves, which was a precursor to serious economic dysfunction, because when you are unable to metabolize that much money, there is something wrong in the virtuous cycle of exports, investments, and so on.
I'll leave you with one final figure. If the United States grows at 2.5% a year, China will have to grow at 8.25% a year simply not to fall behind the United States in absolute numbers. The idea that China will catch up to the United States within 10 years is just an arithmetic impossibility. And so China is a case where businessmen have bought into several propositions that were true 10 or 15 years ago, but are not true now. That shows the constant need to reexamine the premises on which you're building your investments.
Q: China is described in the book as a paper tiger. Why do you come to this conclusion?
China is 1.3 billion people. According to Chinese government statistics, 600 million of those people have a total household income of $3 a day or less. Another 440 million earn between $3 and $6 a day. What we would call middle class, people with a household income of $20,000 and above, account for only 60 million people in China. That's still comparable to a large country, like France, but it represents less than 5% of the Chinese population. China is an extraordinarily poor country. Most business people travel to that small part of China that contains the tiny middle class. And they extrapolate from that.
You always have to remember that China can't sell electronics or toys to people earning $2 or $3 a day. They have to sell those goods to the advanced industrial world. And if the advanced industrial world isn't buying, China is in tremendous trouble. When the United States or Europe stops consuming as much as they did before, you’re dealing with unemployment in a country where unemployment can yield malnutrition. What we're seeing right now is China introducing a massive security crackdown to try to control a situation of enormous unhappiness in China.
China is also holding extremely large dollar reserves. Japan in 1990 and the United States in 1929 held massive foreign currency reserves, which was a precursor to serious economic dysfunction, because when you are unable to metabolize that much money, there is something wrong in the virtuous cycle of exports, investments, and so on.
I'll leave you with one final figure. If the United States grows at 2.5% a year, China will have to grow at 8.25% a year simply not to fall behind the United States in absolute numbers. The idea that China will catch up to the United States within 10 years is just an arithmetic impossibility. And so China is a case where businessmen have bought into several propositions that were true 10 or 15 years ago, but are not true now. That shows the constant need to reexamine the premises on which you're building your investments.
Tuesday, July 6, 2010
Heuristics when arguing --
Adam Serwer, writing in the American Prospect -- "It's a good rule of thumb that anyone responding to a criticism by accusing someone else of enforcing 'political correctness' is factually incorrect. That's because if the actual facts of the criticism were in dispute, they'd dispute them."
from Scripting News.
There's an old saying among trial lawyers: When the facts are against you, argue the law. When the law is against you, argue the facts. When both the facts and law are against you, argue louder.
from Scripting News.
There's an old saying among trial lawyers: When the facts are against you, argue the law. When the law is against you, argue the facts. When both the facts and law are against you, argue louder.
Thursday, July 1, 2010
Solitude and Leadership
Lecture delivered to the plebe class at the United States Military Academy at West Point in October of last year by William Deresiewicz.
Wednesday, June 30, 2010
Worry
A newly qualified chartered accountant applies for a job advertised in the Times. He is interviewed by the owner of a small business who has built it up from scratch. "I need a qualified accountant," says the man, "but mainly I’m looking for someone to do my worrying for me." "How do you mean?" says the accountant. "I have lots of things to worry about, but I want someone else to worry about money matters." "OK," says the accountant. "How much are you offering?" "You can start on fifty thousand," says the owner. "Fifty thousand pounds?" exclaims the accountant, "How can a business like this afford to pay so much?" "That," says the man, "is your first worry."
Right.
Right.
Tuesday, June 29, 2010
Probability Problem from Gathering 4 Gardner
Someone you do not know tells you "I have two children, one of whom is a son born on a Tuesday." What is the probability that this person has two boys?
a) 1/2
b) 1/3
c) 13/27
d) Cannot tell from given information.
Answer.
Monday, June 28, 2010
Cause and Effect in a Single Frame
It never occurred to me that this broke any rules until this post pointed it out. Interesting how we can telescope it all into a single event.
All Streets
Ben Fry made a wonderful map of the United States by combining all the road maps for every county. Geographic features -- cities, rivers, mountains, shorelines -- emerge from the shapes of the roads.
Thursday, June 24, 2010
Monday, June 21, 2010
Friday, June 18, 2010
Thursday, June 17, 2010
Wednesday, June 16, 2010
Another example of the 80-20 rule
More like a 90-10 rule, which is often true as well. Creators, Synthesizers, and Consumers. On an unrelated note, I'm guessing that creators are not as interested in iPads.
Daily Affirmation
How could you not have a good day if you tell yourself this every morning? It starts with "Look! I can be a shark!" and only gets better.
Tuesday, June 15, 2010
Market Forces in the Science Ph.D. Market
But unless the nation stops, as one Johns Hopkins professor put it, “burning its intellectual capital” by heedlessly using talented young people as cheap labor, the possibility of drawing the best of them back into careers as scientists will become increasingly remote. A nation that depends on innovation for its prosperity, that has unsurpassed universities and research centers, and that has long prided itself on the ingenuity and inventiveness of its technical elite, must devise ways of making solid careers in science once again both captivating and attainable.
Interesting article suggesting that there are plenty of people doing science in the U.S., but the market is pushing them elsewhere.
Interesting article suggesting that there are plenty of people doing science in the U.S., but the market is pushing them elsewhere.
Friday, June 11, 2010
Intrinsic v. Extrinsic motivation
This researcher says it is an oversimplification to view motivation in this one (or two) dimensional way.
Tuesday, June 8, 2010
What a great arrangement
This is a great track from a wonderful singing group album by Red Hot & Blue from 1986. I had it on tape and wore it out. I'd pay $20 for the CD.
Monday, June 7, 2010
1001 Video Games to Play before you Die
I thought of this when I saw that (unlike Prince of Persia, which got the big-budget love), Every Day the Same Dream game is now a movie.
Lots of Movies
Big movie weekend last weekend --
1. Toy Story with the kids. Holds up well -- you wouldn't know it was already 15 years old. 5/5
2. Indiana Jones and the Kingdom of the Crystal Skull. Went in with low expectations and was sorely disappointed even after awarding nostalga points. How do you top looking for the Holy Grail? You don't. 2/5
3. Big Fish. Stories that we tell that tell us who we are. Helena Bohham Carter is the perfect character for a Tim Burton movie -- lovely and strange at the same time.
Happy to be returning 3 red envelopes at the same time.
1. Toy Story with the kids. Holds up well -- you wouldn't know it was already 15 years old. 5/5
2. Indiana Jones and the Kingdom of the Crystal Skull. Went in with low expectations and was sorely disappointed even after awarding nostalga points. How do you top looking for the Holy Grail? You don't. 2/5
3. Big Fish. Stories that we tell that tell us who we are. Helena Bohham Carter is the perfect character for a Tim Burton movie -- lovely and strange at the same time.
Happy to be returning 3 red envelopes at the same time.
Thursday, June 3, 2010
Tuesday, June 1, 2010
Tuesday, May 25, 2010
Monday, May 24, 2010
Saturday, May 22, 2010
Friday, May 21, 2010
Sand sculpture
This has made the rounds, but it is really good. Something about the fact that the pictures are made in real-time makes it part of a shared experience that is more powerful. Kseniya Simonova from Ukraine's Got Talent.
Tuesday, May 18, 2010
Jane Siberry Music
All available for download free.
http://www.janesiberry.com/janesiberry/music.html
What should I take and listen to first?
http://www.janesiberry.com/janesiberry/music.html
What should I take and listen to first?
Peabody's Law
Small is still small when it is a little bigger.
-- p. 92 By Grit and Grace by Reverdy Whitlock c. 1988
-- p. 92 By Grit and Grace by Reverdy Whitlock c. 1988
This may be the disruptive force in Education
A guy, a whiteboard, a webcam; Panama!
This guy (Kahn. No, not that Kahn.) has stripped school down to the essentials.
http://www.khanacademy.org/
This guy (Kahn. No, not that Kahn.) has stripped school down to the essentials.
http://www.khanacademy.org/
Friday, May 14, 2010
Fashion is made to become unfashionable
Excellent quote from Coco Chanel, from The Altantic. The reverse also holds true, as seen in the appearance of Dragonball Z t-shirts at a fancy downtown NYC boutique.
Wednesday, May 12, 2010
Kids need facts
Camille Paglia on education. Thanks to Mike Bates HH '81 for the pointer.
Also a good essay from Dorothy Sayers on a classical education (Thanks, Mike, for this, too).
Also a good essay from Dorothy Sayers on a classical education (Thanks, Mike, for this, too).
Finding number of divisors of large numbers
Problem 12 was taking a long time to run (too long to fit within the 1 minute execution benchmark), because I was checking every integer value less than n to determine whether it was a factor. However, when I changed the program to check only up to the square root of n, then assuming that factors come in pairs (unless the square root itself is an integer), then it ran much faster. Probably five seconds for the whole thing, down from not finishing in over an hour. I guess that since the final value was over 76 million, it was taking a long time to do the calculation for every triangle number up to that and then checking all the values up to 76 million. Also got a chance to review casting and thinking about doing calculations outside loops whenever possible, so that they don't have to be done every time inside the loop.
Tuesday, May 11, 2010
The Savages
Better than I expected, not because I thought it would be bad, but because I wasn't in the mood for a serious movie and I really liked it anyway. Both Laura Linney and Philip Seymour Hoffman are great.
In search of a better algorithm for finding factors
Problem 12 has me stuck. The obvious algorithm for finding factors of numbers is too slow to find the first triangle number (1, 1+2, 1+2+3, etc.) to have 500 factors. There should be a solution that takes less than a minute, but Brute Force is not the answer, since they are not distributed in any sort of pattern that I can see. I can't think about it any more today, but I'll be chewing it over in my subconscious (in theory). Or maybe I'll just be thinking about how to go 7-under-par in Wii Golf.
Friday, May 7, 2010
Thank You, Rolling Stone
"We gave these people nearly a trillion bailout dollars, and no one knows what service they actually provide beyond fraud, gross self-indulgence and the occasional transparently insincere public apology."
Whether or not you agree with them, that's some good writing.
Actually, I like this quote almost as much:
These guys couldn't find the truth if it was sitting in their lap playing the ukulele . . . .
Whether or not you agree with them, that's some good writing.
Actually, I like this quote almost as much:
These guys couldn't find the truth if it was sitting in their lap playing the ukulele . . . .
Thursday, May 6, 2010
Problem 11
This one was harder than it needed to be. Take a 20x20 array of numbers between 0 and 99, and find the largest product of four numbers in a row -- horizontally, vertically, or diagonally. The program was actually fine, but I forgot to feed it the initial array. Not even smart enough to rise to the level of a rookie move. I was distracted, which (according to The Phantom Tollbooth) would have landed me in the Doldrums.
Monday, May 3, 2010
Benford's Law
The longer you stare at this, the cooler and stranger it gets.
"Benford's law, also called the first-digit law, states that in lists of numbers from many (but not all) real-life sources of data, the leading digit is distributed in a specific, non-uniform way. According to this law, the first digit is 1 almost one third of the time, and larger digits occur as the leading digit with lower and lower frequency, to the point where 9 as a first digit occurs less than one time in twenty. This distribution of first digits arises whenever a set of values has logarithms that are distributed uniformly, as is approximately the case with many measurements of real-world values."
"Benford's law, also called the first-digit law, states that in lists of numbers from many (but not all) real-life sources of data, the leading digit is distributed in a specific, non-uniform way. According to this law, the first digit is 1 almost one third of the time, and larger digits occur as the leading digit with lower and lower frequency, to the point where 9 as a first digit occurs less than one time in twenty. This distribution of first digits arises whenever a set of values has logarithms that are distributed uniformly, as is approximately the case with many measurements of real-world values."
Friday, April 30, 2010
Riverworld
Depressing for two reasons. First, because I thought it was a movie when it turned out to be a pilot for a series on Sci-Fi. Quality was low. Second, because no additional episodes were ordered. The food tasted bad and the portions were too small.
What is a Memristor?
The fourth quadrant of Resistor, Capacitor, and Inductor. Insert jokes about the Three Musketeers here. I have a lot to learn, I'm just saying.
There's plenty of room at the bottom
Question of the day
This one is mine. I wonder whether people will look back on the huge oil spill in the Gulf Coast and say that it was one of the best things that ever happened to the environmental lobby, because it forestalled or cancelled all of the offshore drilling that Obama had tentatively authorized in the recent energy bill.
That hasn't happened yet, but there was a bit on NPR this morning talking about how the Oil lobby for drilling has put the permission to drill off the coast on the back burner for a while.
That hasn't happened yet, but there was a bit on NPR this morning talking about how the Oil lobby for drilling has put the permission to drill off the coast on the back burner for a while.
How to be a programmer
An article I will read again and again. The applications go beyond programming.
Steve Jobs Letter about Flash
Lots of people are talking/writing about it, but Charlie Stross I think has a good take here. Short version -- no one knows what will happen in the PC market in the next few years, but the future is mobile and the winners will be those who go all in.
Wednesday, April 28, 2010
Clarke's Laws
Arthur C. Clarke formulated the following three "laws" of prediction:
1. When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2. The only way of discovering the limits of the possible is to venture a little way past them into the impossible.
3. Any sufficiently advanced technology is indistinguishable from magic.
1. When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2. The only way of discovering the limits of the possible is to venture a little way past them into the impossible.
3. Any sufficiently advanced technology is indistinguishable from magic.
Multiply digits in 1000 digit number
Interesting errors in problem #8 were arrayOutOfBounds and remembering the syntax for string class operators. Slowly the concept of object oriented programming is coming back to me, but it's not coming that quickly.
Tuesday, April 27, 2010
Off by 1
Done with problem #7. Lots of off-by-one errors around my loops to find the nth prime number. Also, a little bit of a problem with the edge case of 2 being prime, but I just manhandled it into the answer. Not pretty, but I'm tired.
Monday, April 26, 2010
5 & 6 down, 293 to go
Prob 5: Very cool problem, because the short solution (9 lines) was fast up to about first 10 integers (find lcm), then it became much slower. The long solution was not measurably slower for first 30 integers than for the first 10. If the problem had been first 30 integers, I would have had to have used the longer algorithm, but the short one gets the job done for n = 20.
Big insight on this problem was actually something that would have been a cooler solution for prob 3 -- start with 2 and just divide if you can, then change the target divisor to n/2 and repeat until you can't anymore, then move to 3 and then 4. What's cool about this is that it will pick up all the factors of 2, thus knocking out all the composite even numbers. Repeat until the number you're dividing by equals the number you've reduced your target to. Not only are you done, but (by the Sieve of Aristophanes), the last divisor is the largest prime.
Not much interesting in Prob 6. Not sure why it came after 4 & 5.
Big insight on this problem was actually something that would have been a cooler solution for prob 3 -- start with 2 and just divide if you can, then change the target divisor to n/2 and repeat until you can't anymore, then move to 3 and then 4. What's cool about this is that it will pick up all the factors of 2, thus knocking out all the composite even numbers. Repeat until the number you're dividing by equals the number you've reduced your target to. Not only are you done, but (by the Sieve of Aristophanes), the last divisor is the largest prime.
Not much interesting in Prob 6. Not sure why it came after 4 & 5.
4 down
Finished problem #4, which required finding the largest six-digit palindrome number with three digit divisors. The interesting shortcuts for me on this one were that if a number has six digits, then the square root of that number will have three digits (since one million is 1000^2 and 100,000 is roughly 316^2. This made me realize that I could just check divisors starting at 999 and decrementing the potential divisor by one until I reached the square root. This dramatically cut down on the number of divisions to make each time.
It’s not a very generalizable program, unlike some of the others – finding largest prime factor of a number, find the sum of a certain number of values of a sequence – which could be used for other parameters by changing the values of some of the initial conditions. The solution program for this problem was really specifically designed to solve this problem, and it’s not really useful for other (5 digit, 7 digit, etc.) numbers. The structure is basically the same, but it would require more rewriting of the function that generates the palindrome numbers.
A more general solution would involve generating palindromes between the values of x and y and then finding the largest one that is a perfect square or something like that.
Looking at the answers, I was actually a little surprised how much I overthought it. It turns out you can just brute force all the products of 3-digit numbers and then check to see if its a palindrome and you get an answer that way, too. I'm already starting to think about the balance between code that is easy to read (i.e., a simple algorithm) versus code the runs quickly.
It’s not a very generalizable program, unlike some of the others – finding largest prime factor of a number, find the sum of a certain number of values of a sequence – which could be used for other parameters by changing the values of some of the initial conditions. The solution program for this problem was really specifically designed to solve this problem, and it’s not really useful for other (5 digit, 7 digit, etc.) numbers. The structure is basically the same, but it would require more rewriting of the function that generates the palindrome numbers.
A more general solution would involve generating palindromes between the values of x and y and then finding the largest one that is a perfect square or something like that.
Looking at the answers, I was actually a little surprised how much I overthought it. It turns out you can just brute force all the products of 3-digit numbers and then check to see if its a palindrome and you get an answer that way, too. I'm already starting to think about the balance between code that is easy to read (i.e., a simple algorithm) versus code the runs quickly.
Saturday, April 24, 2010
IBM etches small map
"IBM researchers have developed a manufacturing technique capable of etching 1,000 three-dimensional world maps on materials the size of a grain of salt." -- article here from Slashdot.
3 down, 286 to go.
Ok, that one was hard: find the largest prime factor of a 12 digit number. Problems I ran into -- inefficient algorithms, and trouble entering in the number, since 12 digits is bigger than the largest int primitive in Java, and I needed to enter it as a long. However, I couldn't just enter it directly, because the Java compiler tried to read the number as an int, so I had to bring it in as a string, then use the Long.parseLong(string x) method in the Long class to get it into the variable before I could even get started on the algorithm.
This is as much to get me refamiliarized with Java as it is solving the problems. Long way to go . . . .
This is as much to get me refamiliarized with Java as it is solving the problems. Long way to go . . . .
Standards
Aaron Altman: What do you think the Devil is going to look like if he's around? Nobody is going to be taken in if he has a long, red, pointy tail. No. I'm semi-serious here. He will look attractive and he will be nice and helpful and he will get a job where he influences a great God-fearing nation and he will never do an evil thing... he will just bit by little bit lower standards where they are important. Just coax along flash over substance... Just a tiny bit. And he will talk about all of us really being salesmen. And he'll get all the great women. -- Broadcast News
Friday, April 23, 2010
Thursday, April 22, 2010
Subscribe to:
Posts (Atom)