Wednesday 30 March 2011

The Virtual Sledgehammer

Good morning all,
In response to a challenge from Twitter user @7puzzle I was inspired to write a small PHP script that would generate all whole numbers created by a given function.  Here's the original challenge:

"Using 1 2 3 and + - x ÷ available, it IS  to make ALL target numbers 1-9. Is this statement TRUE or FALSE?" - @7puzzle

and here's the output of my routine:


1 = 1 - 1 + 1
1 = 1 - 2 + 2
1 = 1 - 3 + 3
1 = 1 * 1 * 1
1 = 1 * 1 / 1
1 = 1 * 2 - 1
1 = 1 * 2 / 2
1 = 1 * 3 - 2
1 = 1 * 3 / 3
1 = 1 / 1 * 1
1 = 1 / 1 / 1
1 = 1 / 2 * 2
1 = 1 / 3 * 3
1 = 1 + 1 - 1
1 = 1 + 2 - 2
1 = 1 + 3 - 3
1 = 2 - 1 * 1
1 = 2 - 1 / 1
1 = 2 - 2 / 2
1 = 2 - 2 + 1
1 = 2 - 3 / 3
1 = 2 - 3 + 2
1 = 2 * 1 - 1
1 = 2 * 1 / 2
1 = 2 * 2 - 3
1 = 2 / 1 - 1
1 = 2 / 1 / 2
1 = 2 / 2 * 1
1 = 2 / 2 / 1
1 = 2 + 1 - 2
1 = 2 + 2 - 3
1 = 3 - 1 - 1
1 = 3 - 1 * 2
1 = 3 - 2 * 1
1 = 3 - 2 / 1
1 = 3 - 3 + 1
1 = 3 * 1 - 2
1 = 3 * 1 / 3
1 = 3 / 1 - 2
1 = 3 / 1 / 3
1 = 3 / 3 * 1
1 = 3 / 3 / 1
1 = 3 + 1 - 3
2 = 1 - 1 + 2
2 = 1 - 2 + 3
2 = 1 * 1 * 2
2 = 1 * 1 + 1
2 = 1 * 2 * 1
2 = 1 * 2 / 1
2 = 1 * 3 - 1
2 = 1 / 1 * 2
2 = 1 / 1 + 1
2 = 1 + 1 * 1
2 = 1 + 1 / 1
2 = 1 + 2 - 1
2 = 1 + 2 / 2
2 = 1 + 3 - 2
2 = 1 + 3 / 3
2 = 2 - 1 + 1
2 = 2 - 2 + 2
2 = 2 - 3 + 3
2 = 2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 * 1
6 = 3 * 2 / 1
6 = 3 * 3 - 3
6 = 3 / 1 * 2
6 = 3 / 1 + 3
6 = 3 + 1 * 3
6 = 3 + 1 + 2
6 = 3 + 2 + 1
6 = 3 + 3 * 1
6 = 3 + 3 / 1
7 = 1 + 2 * 3
7 = 1 + 3 * 2
7 = 1 + 3 + 3
7 = 2 * 2 + 3
7 = 2 * 3 + 1
7 = 2 + 2 + 3
7 = 2 + 3 + 2
7 = 3 * 2 + 1
7 = 3 * 3 - 2
7 = 3 + 1 + 3
7 = 3 + 2 * 2
7 = 3 + 2 + 2
7 = 3 + 3 + 1
8 = 2 * 2 * 2
8 = 2 * 3 + 2
8 = 2 + 2 * 3
8 = 2 + 3 * 2
8 = 2 + 3 + 3
8 = 3 * 2 + 2
8 = 3 * 3 - 1
8 = 3 + 2 + 3
8 = 3 + 3 + 2
9 = 1 * 3 * 3
9 = 2 * 3 + 3
9 = 3 * 1 * 3
9 = 3 * 2 + 3
9 = 3 * 3 * 1
9 = 3 * 3 / 1
9 = 3 / 1 * 3
9 = 3 + 2 * 3
9 = 3 + 3 * 2
9 = 3 + 3 + 3

Conclusion:
The challenge statement is true.

Wednesday 23 March 2011

#100factsaboutme

Good afternoon all,
after seeing one of the latest twitter worldwide trends I was keen to try this out but didn't want to spam my followers with it 100 times, so I've collated the first half here - I'll be updating this post as time goes on:


1) when I was a child, I ate deep heat and the tentacles off an ornamental starfish
2) I love history when connections can be made with seemingly separate characters.
3) favourite authors include Bill Bryson; Laurell Hamilton; Beverley Cleary
4) In primary school, when all my class-mates wanted to be train drivers, I wanted to be a train.
5) Earliest childhood hero was palaeontologist Robert Bakker.
6) I cried at the cinema watching Dances with Wolves.
7) I love cheese: feta; gouda; halloumi... It's all marvellous!
8) Favourite holiday destination: Sorrento, on the South coast of Italy.
9) Sick of people trying to tell me who my friends are - it never ends well.
10) I've always wanted to be good at languages, but only seem to be able to learn computer ones.
11) After almost 9 years doing a 9 to 5 job I'm still nocturnal at heart.
12) Birds fascinate me - the crow in particular.
13) If all televised sport vanished tomorrow I wouldn't miss it!
14)  My sense of smell is shockingly bad but my tactile sense compensates.
15)  I cannot stand the whole garage/house genre of music.
16) I used to play percussion on a milk float for the Greenwich Festival.
17) I only went to the Millennium dome because they paid me!
18) I have an irrational fear of moths.
19) My parents split up and got back together again.
20) I have a tendency of calling all older relatives Auntie/Uncle, regardless of actual relatedness.
21) I think people can be wonderful but the worst examples of our nature make me wish I was something else at times.
22) I have undergone open heart surgery twice: once aged 2, the other aged 30.
23) I've had numerous cats in my life and never paid a penny for them (lest you count food & vet bills).
24) I almost got thrown out of the Coronet Well Hall for laughing so hard during the film Congo.
25) Weirdest experience was sleeping in a bed with a rifle on the headboard (USA).
26) I freak out about the enormity of the universe when I think about it too long.
27) Most horrible hospital experiences were: the camera down the throat; and having the drain tube removed.
28) Most wonderful hospital experience was having the catheter removed!
29) I was once kicked into a gorse bush by a wild donkey at the New Forest.
30) Most scared I've ever been is when my dad nearly died.
31) My worst subject in school was PE but sport-wise I love kayaking and archery.
32) I've drawn for as long as I've been able to hold a pen.
33) If I had more money I'd be considered eccentric.
34) I use an Apple phone but regard their products with opinionated cynicism.
35) I shook Blair's hand before he became PM and took an instant dislike to him.
36) If I could experience what it would be like to be anyone, I'd choose Sir Isaac Newton.
37) There are so many things I'd like to be better at: woodworking; blacksmithing; tailoring, to name a few.
38) Always wanted to go to a renaissance faire but never gotten around to it.
39) I attribute my command of the English language to my Great Aunt Eileen - her name is uttered with reverence in our house.
40) I miss my Great Uncle Nathan.
41) I am a good cook but my most oft-used ingredient is procrastination.
42) Favourite school experience was the visit from Mr. Mills, the animal man.
43) I get depressed by the news if I read too much of it.
44) I deplore everything about the London underground, from the way it's run to the cost & the total disregard for human dignity.
45) My favourite foods are Italian & Greek.
46) Cannot abide Turkish desserts!
47) One of my favourite books was Barcha the Tiger.
48) I have a habit of going upstairs on all fours if I'm comfortable around you.
49) I dislike this culture of making meat substitutes with vegetarian food.
50) I am very worried that there won't be another 50 things to say about me...