When the zombies come
I'll be upstairs, hoping you
Distract them away...
Wednesday, 28 January 2009
Zombie Haiku
Tuesday, 27 January 2009
Five Little Pigs
Five Little Pigs is the second book by Agatha Christie that I've read, and the first featuring Hercule Poirot. I thought it was quite an intriguing mystery, very different from any that I've read so far, but at the same time featuring many of the tropes that one would expect from a good detective story: reversals and red herrings, unexplained acts that don't fit with the facts and suspects who alternate between trusting and cooperating with the detective one moment to blowing up and accusing him of being a charlatan the next. All good stuff.
I really liked the character of Poirot, and the manner that he conducts himself during his investigation. In seeing a character like Columbo coming years later you can definitely see the impression that Poirot has made on the landscape. The way that the mystery unravels is easily the equal of something by Mickey Spillane (who is my favourite mystery writer), with everything unresolved to the last minute as characters' true motivations come to light. I loved it, and will definitely be reading some more Poirot in the future.
Sunday, 25 January 2009
Snow Crash
While I love William Gibson's cyberpunk stories (well, all of his novels in fact, whether or not one would call them cyberpunk explicitly) it was really refreshing to read something a bit different in a cyberpunk novel as in Snow Crash by Neal Stephenson. While Gibson's novels are always interesting and entertaining, I often feel like there is something in the way that he writes that separates the reader from the novel, from the story. I don't quite know how to put it, but if you have read any of his more recent works I hope that you know what I'm talking about.
Snow Crash is a thrilling, interesting, engaging and thought-provoking novel; the main character, the smartly named Hiro Protagonist, is a world class hacker, master swordsman and one never doubts for a second that he could be both of these two things together as incredible a combination as that might be. The world that he lives in shows a fractured future America, splintered into separate corporate entities and states; hyperinflation has people paying with quadrillion dollar bills, the police and emergency services are gone - people have to rely on private companies - and a pizza delivery guy not showing up within thirty minutes is prime time newsworthy.
As is the appearance of "Snow Crash" a strange new drug that can be administered both intravenously and through viewing files online (in the Metaverse, considering that the novel was written over fifteen years ago he got some of the internet developments spot on). The whys and wherefores of what the drug is form some of the really interesting moments in the novel, with chapter after chapter going in to discussions of Mesopotamian deities and neurolinguistic hacking - without being overly intellectual or distracting to the plot. The action is spot on as well, exhilirating sequences in the real and digital worlds, and plenty of genuine "how are they going to get out of this?" moments.
I've not read any Neal Stephenson before, although I have had a friend recommend his Baroque Cycle quite a few times now. I think that once I get a chance I might give it a go; you should go and give Snow Crash a read if you have any interest in science fiction. And even if you don't.
Friday, 23 January 2009
February
I have a few plans for February to try and get a few longer term things underway. The first of these is to have February be one of my vegetarian months: I'm hoping that this will also help with my goal of getting my weight down a bit. I'd quite like to get down to fifteen stone by the time I'm 30. I don't know how reasonable that is, but I'm going to go for it. When I set that goal I was actually lighter than I am now; I put a bit of weight on over last summer and in the autumn, and haven't been able to shift it yet, despite stepping up the amount of exercise that I've been taking and trying to reduce my calorie intake.
Hopefully being vegetarian for a month will help with that, step up the amount of fruit and veg that I'm taking in. I'll keep a food diary as I go, and if I can I want to try and make February my month of getting my five-a-day as well. This is all to try and get me in a set of good habits for my life. I will go back to eating meat eventually, I don't have a problem with eating meat or fish (what else are the canine teeth for?) but I don't think there's anything wrong with switching your diet to try and get a health benefit either.
If I can get my weight to sixteen stone by the time I go to America I will be very happy. Ramp up the exercise over the coming months if I can, cut back on meat, increase the amount of veg that I get... See what happens. Maybe try and cut back on the amount of carbohydate that I take in as bread. I love bread of all shapes and slices, but it might be good to see how things are without it.
The other one of my 101 thing that I'm going to start in February is thing number 2: to regularly keep a diary for at least six months. I think that this will take several notebooks. A few years ago when I started keeping a diary - actually, thinking back that would be five and a half years ago now, when I started my Masters - I kept writing regularly for about two years, resulting in about twenty A5 notebooks. It was an important part of my life at the time, and if I am honest I'm not entirely sure why I stopped when I did.
I guess I just felt that I had reached a point where I didn't need the diary to help me figure out what I was doing any more. By the time that I stopped recording things (I would write every morning and evening on the train to university, and also sometimes of an evening I was feeling particularly pensive) I was at a good place in my life, started uni again for my PhD, felt like I had a bit of direction. Maybe back in April last year when I set my goals I knew that in the coming months/years I might have need of this coping strategy again, a need of somewhere that I could create an expression of my self that would be of use for my self-study.
Maybe it was just one more thing to include in a list of 101 things to do before I turned 30, who knows?
Anyway, between now and the start of February I'll read another book or two (more on that in a future post, I have an interesting little thing for my reading that could be quite handy, especially when it comes to reading some classic literature), I'll get another few haiku pulled together from the random words and thoughts that permeate my mind, and I'm trying to get another piece of flash fiction out. I've gone dry on ideas at the moment, but in sorting my laptop out I'm running across old files containing notes on stories and ideas, first paragraphs etc. It may be that some of them have something which will help.
Take it easy people, more to come soon.
Wednesday, 21 January 2009
America!
Progress! Out of the blue this afternoon my friend Dave called me up from the UAE, and five minutes later we were talking on MSN. After a half hour chat or so we had booked our flights for our road trip to the States this summer!
I had made it one of my 101 things to visit five US states, way back last April when I wrote my list: fast forward to late August and Dave and I started making plans to go on a road trip from New York to San Francisco. At times as the last couple of months have passed by I have wondered if we would actually do it. Not because neither of us were half-hearted about it, just because things come up, you know? Life gets in the way sometimes, with all the things that it throws in your path.
Well, "Ha-ha!" We're doing it! Flights booked. Fly out to New York on the 6th of July, fly back from San Francisco on the 10th of August.
More on our itinerary as we finalise it!
Sunday, 18 January 2009
Two Years To Go
Well, it's my birthday. Today I turn 28. Happy Birthday to me etc.
In some ways, I think that I was hoping that I would have done more of the things on my list by now, but then some of the things that I've been working on are quite long term. Reading 101 books and the other media things are coming along quite well, and there are a few things that I am sure will come together quite suddenly as this year develops. I am confident that I will have hit 30/101 by the middle of the year, or soon after my US road trip.
Someone has suggested that I could combine four or five of my goals into a single weekend, possibly my weekend in London. I might do this, it sounds like it could be a lot of fun. I could do my weekend in London, deposit my five books for BookCrossing, have a picnic, spend the afternoon in a bookshop... Maybe even take 101 pictures for Flickr.
I think I have my domain name picked out. Obviously not going to say what it is just now! But I think that this will be the name that I use when start my webcomic. Things are chugging along in the background for this too, lots of ideas that I am trying to think through. I have to start drawing and sketching - I'm not under any illusion that the possible success of a webcomic would rest on my ability to create art - but I would need to do something so that I appear semi-serious about it!
Been writing a lot more in recent weeks, and since setting up a writers group with other people who did NaNoWriMo in November I've had a lot more drive to write things: especially pieces of flash fiction, and I'm really looking forward to Script Frenzy in a couple of months. I have a killer idea I think, well, it seems good at the moment. I have to do a little bit of research to do, but mainly just in terms of population sizes and geography for a certain part of the world in a certain time period. A couple of accurate period details wouldn't go amiss either.
Depending on how work goes over the next few months I also hope to fit in a couple of the video game replays. I'll possibly also try and squeeze in Gregory Horror Show, a game which I played for an hour and loved and then skipped to play something else. Killer7 will be replayed soon as well, I'm feeling in the mood for something surreally brilliant. Like Resident Evil 4 I think that will be a strictly day time only playing situation...
There are lots of other things from the list that I could write about, but that's all I'm going to say for now.
It is my birthday after all.
Recent Books
I've been a bit negligent about book reviews recently; apologies, I have been active in doing other things, not just sitting around doing nothing. Hmm, well, I have done a little bit of that, but I guess that most of my writing in the last few weeks has been to do with fiction, or writing programs for the Project Euler stuff.
Time for a quick catch up then!
Wrong About Japan by Peter Carey
Interesting book in the travel writing section; quite short, only took me two sittings to read it. Was interesting and made me nostalgic for my time in Japan, but also seemed like a kind of weird story. The title makes a lot of sense, in that every one of the author's preconceptions were wrong when he finally went to Japan with his son. I could never quite figure out what the purpose of it all had been (perhaps it was mentioned and it just didn't stick out in my mind). It's an accessible book, and good if you want to maybe know a little more about Japan in a rounded sort of way, but you probably could get more of an insight from reading a Lonely Planet or Rough Guide.
Year's Best SF 13 edited by David G. Hartwell and Kathryn Cramer
I've been reading this anthology over the last few months; I've been renewing it for ages. It wasn't a bad anthology, but I have read much better. A few standout stories - I should have written down their names, but the two that spring to mind are about kids growing up too quickly, lingerie models at the age of ten; and one where holidaymakers get pressganged into military service through the application of a drug that negates a sense of self and personal identity, reducing a person to understanding the world in third person - can't quite make up for the rest that tend to underwhelm. The annual "Mammoth" books are much better; I think I'll be working my way through one of those over the next few months.
Blink by Malcolm Gladwell
I was a bit indifferent to this book in the end; the thesis of the book is that there are areas where we can make almost instant judgements about situations and circumstances based on great background experience of an area or just common sense. In fact, by thinking about something for too long we can often derive the wrong opinion on something. I think that there were lots of good little stories and case studies about how we can use this kind of philosophy and ideas, but in the end I failed to see where the evidence to support this kind of thinking applies more generally. Interesting, but it didn't make that much of an impact in the end, although I'm still thinking about it I suppose. Maybe I'm thinking about it too much...
House of Suns by Alastair Reynolds
I've read all of Reynolds' previous novels, and this one didn't disappoint, even if it didn't reach the heights of some his previous brilliant novels. The central idea - a dynasty of 1000 clones touring the galaxy, six million years old, comes under attack - is done brilliantly. The whys and wherefores of how this happens take some time to go through, and then it seems like the second half of the book is rushed a bit, right up to the end. I kind of felt like it was going to lead up to something more than it did, but the sheer scale and scope of the ideas is mindblowing. Space opera is a genre I really like, and after reading this I think I'll be re-reading some of his other books as part of my re-reading. Oooh, and I'll re-read some Peter F. Hamilton too!
Project Euler, Problems 12 and 21
The two problems that I've worked on most recently have both involved divisors of numbers; this meant that I first wrote a few small subroutines to do with divisors, calculating the number of divisors or the sum of the proper divisors of an integer. This wasn't too bad, but I really think that I am approaching the limits of the kinds of problems that I can tackle with my current level of C++ knowledge.
C++ can only handle numbers up to just over 4 billion, and some of the problems that I will probably have to check soon will be much larger than that. I know how to tackle them but for the fact that C++ cannot cope with numbers entered in that natural manner. Been thinking a bit about how to set up a new class of input, where larger numbers could be handled. At the end of the day, we're just thinking about a string of characters, and how to do operations on them. I've seen a couple of things recently that give me some ideas on how I might set up something like that.
On to the problems...
Problem 12
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. 28 is the first triangle number to have over five divisors. What is the value of the first triangle number to have over five hundred divisors?
Wrote a script that could count the number of divisors of an integer, then started a loop through something generating the triangle numbers, checking the number of divisors. It took a while, but when it found it gave me the output to tell me what the answer was. It took quite a long time!
Problem 21
Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a is not equal to b, then a and b are an amicable pair and each of a and b are called amicable numbers. For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; so d(284) = 220. Evaluate the sum of all the amicable numbers under 10000.
This was straightforward given the previous routine for calculating the number of divisors of a number; we use the same criteria for evaluating if one number is a divisor of another, and so we summed all of those. Then, we calculate the sum of the proper divisors of a number, a, and then check if the sum of the proper divisors of that number is equal to a. If the sum of the proper divisors of a is different from a itself then we have found a number which is part of an amicable pair.
Looping through the numbers 2 to 10000 and summing all of the positive results that we find gives the answer.
Sixteen out of twenty-five. Not bad considering that most of those have been done in the last few weeks. The next small subroutine project I need to do is figure out how to generate a list of prime factors of a number; I'll also have a crack at the large number string stuff that I mentioned at the start of this post. With a bit of luck and work, I think I might have cracked another nine by the end of February!
Flash Fiction: No Fifth Symbol
Nathan Ryder
Our scans found a civilisation, Lunar Rhythm, unknown to ours. Normal civilisation growth up to sub astronomic transit, with no aspirations to go out to stars and void. Basic humans, slight, dark hair and brown sight organs; laughing always, childish in a way, but good, caring to us. No major social quirks.
Almost.
Ann and Brian, our linguists, took much fun in studying Lunar Rhythm and in particular it's communication protocols. Lunar Rhythmic was not difficult, basic syntactic constructions with old root grammars and a standard dictionary. That said, Ann found that although our civilisation and Lunar Rhythm had common starting points, Lunar Rhythmic had a syntactic quality that was anomalous; translation was minimal from Basic to Lunar Rhythmic, minor word variations only.
Ann had an insight. I can call to mind Ann and Brian discussing an anomaly that Ann saw during our first formal contact.
A sound hits my auditory canal, Ann's gasp.
“No fifth symbol!” Ann shouts.
“What?” I ask.
“No fifth symbol,” again; Ann and Brian talk quickly. By and by, I grasp syntactically what is passing. Following discussion, our party confirms Ann and Brian's thoughts. A schism such as this could not occur naturally. “Why is Lunar Rhythmic as it is?” was our mantra for many days.
Many days pass. A thought occurs, from Brian, for us all to hold communication for a month with a lack of fifth symbol. I can call to mind Ann nodding, “This will aid us in sympathy with Lunar Rhythmic!”
Our hosts, Lunar Rhythm, support us in this. John and Alan had suspicions at first, but soon took to communicating in Lunar Rhythmic. Ann, Brian, Mary follow. I, as Captain of our ship and party, was last, my suspicions many. I thought it crazy, talking in this way at first. Days pass, and I find my thoughts taking an unknown quality. Calm, lack of fifth symbol causing brain functions to flow – truth, thoughts flow without a fifth symbol, a diminution of options improving cognition.
And such joy in thinking and in watching days pass on Lunar Rhythm. Moon arcs at night claim air from my lungs on all occasions! Spring days, so happy! Our party find joy in this radical concision of talking and thinking, of Lunar Rhythmic, a form that is shaping our minds as days pass among a caring, good company...
Thirty months pass. Our party knows it should bid so long to Lunar Rhythm.
All of us talk. An hour at most all of us discuss, but it is not a hard pill to swallow.
Our party will stay with our hosts and patrons, Lunar Rhythm. Such joy was found at our choosing. Local customs hold a particular oddity to us still, but Ann and Brian's scholarly discussions point our path, our way. No major social quirks.
Almost.
Thursday, 15 January 2009
Project Euler, Problems 33 and 37
Another two problems solved; I wish I could say that I simply sat down and thought of an efficient algorithm first go, but that's really not the case. With the first of those I've mentioned today I basically got two of them just by thinking. The final one came about basically because I finally put enough restrictions on things to force out a small number of choices to manually inspect.
It's a victory... Maybe not a noble win, but still. Onwards and upwards! Eleven more to go...
The second of the two that I've written a bit about here was a bit easier, it was basically just coding something and then sitting back to let it run.
Problem 33
The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that 49/98 = 4/8, which is correct, is obtained by cancelling the 9s. We shall consider fractions like, 30/50 = 3/5, to be trivial examples. There are exactly four non-trivial examples of this type of fraction, less than one in value, and containing two digits in the numerator and denominator.
So, for this puzzle it was effectively a case of searching through a series of pairs of numbers for certain conditions. First of all run through numbers a from 11 to 98, and for each of these go through numbers b from a+1 to 99. We consider fractions a divided by b (as this guarantees that the fraction will be less than 1). Eliminate any where a or b is divisible by 10. Sort out the pairs such that we have numbers which are coprime (that is, they share no common factors) and so that they have at least one digit the same.
I created two subroutines for this: the first checked if two numbers were coprime, and the second figured out the biggest common factor of two non-coprime numbers. This made simplifying things easier, and helped to exclude lots of cases. It would have been a little tricky (due to the depth of my knowledge of C++) to just create a routine which found the four things that we wanted, and so I just basically kept adding conditions and narrowing the number of pairs of numbers down and down until there were sufficiently few that I could look over them.
Problem 37
The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3. Find the sum of the only eleven primes that are both truncatable from left to right and right to left. NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.
This was quite straightforward really, it just took a bit of programming to sort through the possibilities; as the number of digits grows the number of things that have to be considered increases too. It just took a little time, and I gradually increased the number of digits. The largest had six digits, and it took a while to search through (of course, I wasn't searching through every six digit number, only the odd ones, and excluded any which a 0 digit in the middle, or started with 4,6,8 or 9) and consider all of the extra little cases.
The thing which I'm still thinking about with this, is from the set up in the question: "Find the sum of the only eleven primes that are both truncatable from left to right and right to left." So there are only eleven primes that satisfy this, huh? I wonder how we can prove that those are the only ones? My program has shown that there are only eleven primes satisfying that condition up to one million... Why are there none beyond that?
Tuesday, 13 January 2009
Flash Fiction: Homage to '253'
Nathan Ryder
Martin Reed
Outward appearance
Black suit, open collar, striped sweater wobbling on the line dividing trendy and nerdy. His hair, too short to do anything with, too long to look tidy. He pushes his glasses up (slightly too big), staring intently at a document. His other arm is slung protectively around a backpack resting on his knees.
Inside information
Martin isn't reading the paper on tutoring strategies. He looks through it. All he can think about is the growing feeling that something is now not right in his eight month relationship. Trying – and failing – to identify what is wrong now he has come to a conclusion: he must break up with Emily before they both end up hurt.
What they are thinking or doing
It's not you it's me. No, he tells himself, you can't say that after eight months.
I just feel like our lives are going in different directions; I don't want to hurt you. Well, the last part is true...
The announcer's voice mumbles the next station. Martin wakes from his thoughts and shakes his head. Putting the paper away he thinks about work.
That lasts a second, then he begins to think about Emily. What happened? What am I not getting?
Stepping off the train he clumsily drops his wallet. Picking it up he goes to take his ticket out and instead pulls out the picture of Emily that he keeps there.
Smiling eyes, her shy grin.
In a second he realises: the next step.
Walking away he rehearses in his mind, I love you. Will you marry me?
Monday, 12 January 2009
Flash Fiction: ...And I Feel Fine
Nathan Ryder
From: Carolyn Webster, Senior Tour Supervisor
FAO: All Museum Tour Staff
Tour Guide Assistance Notes for “The End of the World! (as we know it!)” 28.05.19
- Emphasise, when talking with visitors, that this is the latest in a long series of state of the art multimedia experiences for visitors at the Museum.
- Emphasise especially that the exhibition is free; make special mention of the well stocked Museum Gift Shop.
- Use of recording devices of any kind is strictly prohibited in all exhibition spaces. Storage capsules are available for a small refundable deposit in the cloakroom adjacent to the Gift Shop.
- The Museum's legal division is certain that we are perfectly within our rights – through public domain, fair use and parody laws – to use the media that we have in our exhibitions. That said, all Museum staff will use the assigned exhibit names when leading tour groups and when dealing with questions from members of the public. Regardless of how a member of the public refers to an exhibit, you will use the name given in the official tour programme.
- If you believe that there are any questions that have not been raised in this outline, or if a member of the public asks you a question that you do not feel qualified to answer, please refer to a more senior member of the Museum Tour Staff.
From: Carolyn Webster, Senior Tour Supervisor
FAO: All Museum Tour Staff
Addendum #1 30.05.19
Having mentioned similar in point 4 of the original Tour Guide Assistance Notes, it pains me to reiterate the point for certain members of staff. Despite members of the public referring to it by another name, you are to refer to the exhibit “Post-Civilisation Simian Earth” by that name and by that name only.
From: Carolyn Webster, Senior Tour Supervisor
FAO: All Museum Tour Staff
Addendum #2 03.06.19
Any resemblance between the appearance of the lead character solidgram in “Post-Civilisation Simian Earth” and “Viral Neo-Luddite Earth (circa 1971)” is purely coincidental. DO NOT get drawn into conversations on the subject. DO NOT acknowledge or mention the name Charlton Heston. Refer all queries to myself or another senior member of the Museum Tour Staff.
From: Carolyn Webster, Senior Tour Supervisor
FAO: All Museum Tour Staff
Addendum #3 11.06.19
Following an incident during the first school tour of the day, access to the “Reanimation Station Military Base!” exhibit is limited to members of Museum Technical Personnel. Any queries by members of the public or by “journalists” should be met with a request to contact me.
From: Carolyn Webster, Senior Tour Supervisor
FAO: All Museum Tour Staff
Addendum #4 15.06.19
The “Reanimation Station Military Base!” exhibit has reopened. No school tours or individuals under the age of 18 are to be allowed access to the exhibit. All staff and members of the public should respect the yellow lines on the floor and endeavour to stay clear of them. No one should cross the red lines painted on the floor, and in the event that a member of the public does cross a line, Museum Tour Staff should:
- Order them to return;
- Not follow them;
- Alert members of Museum Security and Technical Personnel.
From: Carolyn Webster, Senior Tour Supervisor
FAO: All Museum Tour Staff
16.06.19
VIRAL INTRUSION OF SOLIDGRAM SOFTWARE!!! LEAVE VIA EMERGENCY EXITS OR MAKE YOUR WAY TO THE MAIN SECURITY DESK!!! MUSEUM WILL BE SEALED IN FIVE MINUTES, ALL DATA AND POWER LINES WILL BE SEVERED WHILE INFORMATION SYSTEMS ARE PURGED, SAFETY WITHIN THE MUSEUM COMPLEX CANNOT BE GUARANTEED!!!
From: Carolyn Webster, Senior Tour Supervisor
FAO: Museum Board of Trustees
Autotyped from dictation, 18.06.19
I was left a project to supervise that I didn't want, that, that no one wanted. And yet your response at the start of this was, “No worries, Carolyn is always up for a challenge, Carolyn always comes through!”
You didn't listen on the 11th, you just wanted the story to go away.
You didn't listen on the 14th, you just looked at the margins. What do they look like now?
You can find yourself someone else to ignore. Consider this my resignation.
From: Carolyn Webster, Senior Tour Supervisor (former)
FAO: All Museum Tour Staff (those remaining)
Autotyped from dictation, 18.06.19
This should be Addendum #5 I think, my last message to you doesn't count. I always liked things to be regimented. Sorry if any of you thought I was a stuck up bitch for being such a stickler for the rules. I've resigned. The tours are all cancelled, the whole exhibition is to be closed. I was accused of cutting corners, but I didn't design this exhibition I just took over the project.
You only have to look at half of the things that the exhibits were based on to know that it was never going to end well. I am sorry that I couldn't persuade the Trustees to close the exhibition sooner; they'll say that we – that I – should have stepped in sooner on the day. I know it wasn't enough, please believe me that I did everything I could.
CW
Project Euler, Problems 4, 15 and 35
Do I have a life? Apparently not... Over the weekend and then this morning I spent some time working on some more problems with Project Euler. Saturday and Sunday were pretty quiet days all in all I suppose, and am still waiting to hear about a new work project. May as well spend the time learning a bit of C++ and keeping my mind active.
Problem 4
Find the largest palindromic number that results from multiplying two 3-digit numbers together. This was quite straightforward; iterating for the two 3-digit factors it just meant I had to write a couple of very short scripts that could recognise palindromic numbers. This meant making two slightly different routines, one for 5-digit numbers and one for 6-digit numbers.
After that it was just making sure that the largest number was carried out as a result.
Problem 15
Starting in the top left corner of a 2×2 grid, there are 6 routes (without backtracking) to the bottom right corner. How many routes are there through a 20×20 grid? There's a picture here to show what the routes are through the 2x2 grid if you can't picture what the question means. This didn't require a program, just a little thought back to some combinatorics that I did at uni. The numbers were pretty big, too big for the computer's calculator at first; a bit of pencil and paper cancelling of factors got me there soon enough.
Problem 35
How many circular primes are there below one million? Go here to see what is meant by the term circular prime. This took a little time to arrive at an algorithmic solution. I started off by thinking in terms of the restrictions that are placed on a number if it is a circular prime. Once we move out of single digits the only digits that can be in a number are 1, 3, 7 and 9, which limits greatly the number of numbers that we would have to consider.
However, my understanding of how to permute things in C++ is not quite there yet (I could do it with no problem in Maple). In the end I went with a brute force approach: tell the program to consider the number and the circular numbers that result. Then if all of these are prime then add 1 to the total.
Inelegant if I'm honest, but it did the job.
This now takes the total to twelve! Am slightly amazed by how many I've done since the New Year. Here's hoping that I am picking up enough C++ basics for when I start to work on harder projects. Thirteen to go...
Haiku
Hold your hand, squeeze it.
A raindrop - no, a tear.
Late winter; you leave.
I wait, sigh daily:
Flick-flick, change the show, quick-quick.
The news stays the same.
The end of winter,
A century late; time pauses,
Spring unsprung, for now.
These all came about in the normal way that I write haiku: I sit there thinking about a first line, five syllables that will make some kind of sense. Once I have those I think about how I can finish that off until something which sounds right has come to me. If possible I try to get some reference to passing time in. I'm not sure why exactly, but it just seems appropriate.
The following was something that just came to me after I ate at Yo!Sushi for the first time last week.
Oh pumpkin croquette!
Are you traditional fayre?
Hmm; yum! I don't care!
It is what it is, that's all I'm going to say on the matter...
Saturday, 10 January 2009
Project Euler, Problems 7 and 41
I put together a simple program in C++ that checks out whether or not a number is prime, i.e., whether or not it has any factors besides itself and 1. It was eventually writing a separate thing for this that helped me out, as despite what I'd learned in the past I was trying to make one program to do everything that was needed for the actual problem. Bad idea. Things are so much simpler if you break things up into their component parts...
Problem 7
Find the 10001st prime number. Once I had the program for checking whether or not a number is prime this was quite straightforward. I started off with knowing that 2 is the 1st prime number, and then working through all of the odd numbers after that and adding one to the tally every time that I found one.
Problem 41
What is the largest n-digit pandigital prime that exists? This was a little trickier, but not much more. It just took a bit of thinking. Firstly, what is a pandigital number? Well, a 5-digit pandigital number is, for example, 34251, a number which contains the first five digits once and once only. A 4-digit pandigital would be 4123 or 1234 or 3142, and so on. After a little thought, it occured to me that there cannot be 8- or 9-digit pandigital primes (if you're reading this Matt, do you know how/why that occurred to me?) and that the largest possible would be a 7-digit pandigital number, i.e., one that contained all the digits from one to seven.
It was then straightforward to think that it was most sensible to start searching from the extreme end of the numbers, 7654321, and to put conditions on the numbers; one only wants to check without 8, 9 or 0 in, one doesn't want duplicates of digits... Once I'd written those conditions in to the program, it was fine.
This takes my total of problems solved to nine. Sixteen to go. Might get one more done this weekend. It's good to keep thinking, and it also gives me a chance to keep learning bits and pieces of C++.
Keep learning people, it's the thing to do!
Tuesday, 6 January 2009
Flash Fiction: Ethical Conditions
Nathan Ryder
There are two or three of Them outside right now. I can hear that high-pitched chiming that they make. I guess it's Their way of talking or something. I don't know.
I wish I had paid more attention in school. I hated science. I didn't care. I wish I knew more about it now. I might know where I am, or know how to figure it out. The stars look wrong. There are so few. I only know that because Mary told me. I'm so stupid.
I might know how They can float, how They can build these things which look like houses but aren't, how They can make me sleep just by looking at me...
...I might know what this thing, this machine, that They've put in my side is, and why I hurt after They have visited. I always sleep when they come. They just look at me, I think – it's difficult to know if that area of their skin is an eye – and it happens, I just black out. I always hurt after, but it goes away quickly.
The house is alright I guess, for a prison. It's warm, there's food and water, and I guess they sampled our radio, or maybe just took a recording of the internet and filtered out some music, because I haven't heard the same show twice so far.
Mary lives in the next house, with three other women. There are no other women in my house yet. She says she has been here for two years, give or take. She tried marking the days off on one of the walls, but every time she woke up the house was like brand new. She tried marking the days on paper, but it was the same, every time she woke up the house was renewed. All of the other women say the same thing happens to them, but between them try to keep a calendar. I don't care. I just want to go home.
A week or so ago, I walked out, kept going for four days. There were endless houses, all identical to mine, all off the same road. The women I met had similar stories. The day came around when they put me to sleep. They found me, like clockwork, and when I woke up I was back in my house. Mary said she tried it. They always find her.
I haven't seen a man since I arrived.
I look out of the window, and see Them looking up. The usual one points at me and then turns back to the other one. I duck away, fearful that He or They might be about to do me some harm.
I want to go home. My name is Nicola Smith. I'm twenty-two years old and I don't know why They are keeping me here. This is bullshit. It's been months now. Why am I writing this? The paper will be like new just as soon as I go to sleep anyway.
"Do you admit that there is a conflict of interest?"
The reporter won't get off that track, and I can hear the judgement in his tonal shifts; the telepresent public relation tell me to give him the standard response.
"Since we haven't been able to make them understand our language, or even train them in more than a basic way with regard to our intentions I agree that we have to tread carefully. But make no mistake, these are animals," I begin, pause, and then continue, "Social animals, yes, but they're barbaric, warlike, highly suspicious of other tribes. Keeping them here is an act of kindness-"
"They're sentient," the reporter says, "Early tests on them-"
"-were flawed," I say sharply, cutting in and giving the impression that the reporter had better not cut across my statements again. It's all so carefully scripted, and I'm bored, I have other work to do. "Long term observations of them in their natural habitat showed that they do not learn with time. As time moves on they become even more rigid and tribalised, a flaw on their social constructions that grows hungry for destruction. Coupled with the imminent atmospheric collapse, keeping this group is necessary for the sake of the Quadrant's Biosphere Specimen Archive."
The public relations whisper away at me on the closed channel. They're bored too, and give me permission to take my pick of the closing statements.
"As for their caviar," I conclude, pointing the way to him, "It is a luxury item and the profits from its sale supports the energy cost for their habitat. You might think it is a terrible thing, but I assure you we operate under the strictest of ethical conditions, approved by the Quadrant Consensus."
He gives a gesture that is easy to take as a shrug; he doesn't really care, his righteousness is an act. This is a puff piece for his news service, all of us know it. No one wants to really debate this any more. He travels ahead, still surveying and recording. The telepresence is disabled, science staff offline.
I glance back and see that one from the latest batch looking down.
I check the records and realise that she is alone in her dwelling. The new annexe is waiting to be filled with the next hundred thousand who are arriving, but I'm sure I can allocate one or two dwelling mates for her.
I really wish public relation would talk directly to the reporters, even if the reporters are only vaguely interested. Animal husbandry is my area, not ethics.
I look up and see that the female is gone from the window, and move off to catch up with the reporter.
Project Euler, Problem 79
I decided to take another look at some of the problems over on Project Euler, and number 79 jumped out at me yesterday evening when I saw it. Within about ten minutes I had an approach, and in less than ten minutes after that I had a solution. No explicit calculations or anything like that required, just a bit of logical thought.
Here's the problem as stated:
"A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was 531278, they may asked for the 2nd, 3rd, and 5th characters; the expected reply would be: 317.
The text file, keylog.txt, contains fifty successful login attempts.
Given that the three characters are always asked for in order, analyse the file so as to determine the shortest possible secret passcode of unknown length."
Now, I'm not going to go into all the details of it, but my approach was as follows: delete any duplicates, they won't tell you anything new; since none of the entries contain multiple copies of digits and we're looking for the shortest possible passcode, assume that there is only one instance of a digit in the code; then simply look, it's not that hard after that to deduce what the correct answer is.
This takes my total of completed problems on Project Euler to seven. Only another eighteen to go, and I think I've about reached my limit of problems that can be solved with pen and paper or by inspection. There are several others I've made inroads on by considering what the problem is actually asking, but they'll all require some computer assistance and practice of C++.
Which is cool!
Sunday, 4 January 2009
World War Z
Max Brooks' World War Z is a fascinating idea that on the whole works: an oral 'history' of humanity's stuggle against a global epidemic of zombies, it is a collection of short stories presented as interviews with the survivors of the war. From civilians through to the top brass, from many countries and all walks of life, Brooks has really given the story that he wants to tell a lot of thought. The picture that he paints is a totally changed world, and changed in ways that one can't imagine at first thought; a lot of zombie fiction shows the immediate change, or people slowly being picked off one by one. It was interesting to see a world under threat, but not so immediately devestated that a fight back is out of the question. His take on tactics and ways that humanity would have to change or a logical conclusion of the new threats that people would face.
The only downside to the scattershot collection is that sometimes it feels a little too disjointed. Some of the 'interviews' are longer, but there are times when I really felt like I wanted a much longer "survivor's tale"... However, as a collection it is well worth a read for sci fi and horror fans alike.
Saturday, 3 January 2009
Thing 46: Shadow of the Colossus
Shadow of the Colossus is one of the most breath-taking and atmospheric games on the previous generation of consoles. A bit strong for an opening line perhaps, but I'm pretty sure that anyone who has played the game will be right there with me. A young man journeys to a faraway land in the hope of finding a way to restore life to his true love; on arrival he is told that this can only be done if he defeats sixteen stone giants, the Colossi, massive, almost invulnerable...
One would normally expect sixteen levels of increasingly tough battles, fight a horde of minions before facing each "boss" - except this is a game which throws away many gaming conventions. Instead of sixteen levels, there are just the sixteen stone giants, all different, all seemingly alive and with their own personalities when it comes to attacking and defending themselves. In order to reach them the young man rides his horse across a lonely landscape, no background music, just the sound of the wind and his horse's hooves beating away at the plains.
You reach a Colossus and as you size each one up you think, "It is on." Most of the creatures are so massive and so well defended that you can't simply walk up to them and start attacking: in fact, you can't simply attack them at all. Each creature requires a specific plan of attack in order to find vulnerable spots on their body. The gameplay of clambering over these living playgrounds, jumping from place to place in order to find a weak spot, or leading the Colossus in a certain direction in order to crack a piece of armour or allow you to jump on it... What can I say, it makes you feel like you're there. I'm gushing, but watching this little man with a little sword run like hell as a massive hand seems to fall out of the sky to crush you - literally edge of your seat stuff.
And that's just the gameplay, the story itself is also... different. At first you don't really notice it. Subtle differences that seem to accrue as you progress through the game, your character's appearance slowly changing, almost imperceptibly. Short cut scenes after defeating every fourth Colossus also indicate that all is not what it appears to be, leading to an ending that is at once shocking and bittersweet. There is some hope in the end, and a promise for the future, but you're left with a great feeling of loss.
Have you ever read a book that you secretly wish was written just for you, but which is so great and wonderful that you want to share it with everyone you know? The first book I ever read that made me feel that way was Earth Abides by George R. Stewart (more on that some other time perhaps). Shadow of the Colossus was the first game that gave me a similar feeling. Replaying it as part of 101/1001 was brilliant, almost a present to myself, and once again it gave me so much to think about. I've been playing quite a lot of independent games recently; low res, low memory but completely addictive games that go for gold by virtue of their gameplay. Shadow of the Colossus goes for gold and beyond by virtue of being a wonderful story, leaving so much to the player and yet providing a magnificent platform for in game exploration and adventure.
I'm gushing again. I'll stop there. Just trust me, if you ever get the chance, give it a go.
Spoiler Haiku I
Two men? sit freezing;
The fire and light are dying.
They sit; wait; and see...
Thursday, 1 January 2009
Last Year, This Year
2008 was a big turning point for me. Deciding to do 101/1001 was one of the best things I've decided to do, and since starting it I haven't regretted doing it. Halfway through the year I read "Yes Man" by Danny Wallace, and that started to change my perspective on how I approach things, being open to chances.
I've not said yes to everything that's come my way over the last six months, but I've said yes to more than I think I would have before. A friend took a look at the blog I've been keeping a few days ago and said, "You've been doing this for eight months and you've only crossed off nine things on the list??? How are you going to get the 92 in the next two years???"
With a bit of work, a bit of luck and a bit of fun...
Ten Things I Will Definitely Have Achieved In 2009
1). 12. Fill Terramundi
2). 15. Write 101 haiku
3). 19. Complete a ScriptFrenzy
4). 26. Make my Christmas cards one year
5). 41. Visit five US states
6). 64. Buy a domain name
7). 75. Re-read "Calvin & Hobbes"
8). 78. Re-read Scott McCloud's books on comics
9). 89. See a Shakespeare play
10). 95. Release five books into the wild with BookCrossing
Ten Things I Hope To Have Done/Completed In 2009
1). 1. Read entire Bible
2). 20. Enter the SFX Pulp Idol competition
3). 36. Create a webcomic
4). 42. Spend a long weekend in London (including a West End show)
5). 62. Confirm the number of stacked 4-tangles
6). 67. Sell five things on eBay
7). 73. Re-read "The Sandman"
8). 87. Buy a Nintendo Wii or Xbox 360
9). 91. Attend a live opera
10). 100. Send a Valentine
Five Things I Might Do In 2009
1). 2. Keep a diary regularly for at least six months
2). 31. Learn to juggle three balls
3). 34. Bake a cake for a present
4). 93. Complete a crossword (seriously, I've never been able to complete a crossword)
5). Various: replay about six of the games!
I got about three quarters of the way through Shadow of the Colossus a few weeks back, and then preparing for Christmas, work and Nanowrimo intervened... I wonder if I can finish it on New Year's Day, start the year off with a bang? Let's see.
Say yes.