Re: Lovefilm, yes or no?

2010-04-14 Thread Peter Edwards
I'm not sure if that interview question thread proves you are all deranged
nutters, maths geniuses or scarily good programmers.
Probably a bit of each.
Jeez, where has my "PHP For Beginners" book gone, it's not too late for a
career in a meejabollix agency.
Cheers, Peter

On Apr 14, 2010 10:53 PM, "Ruud H.G. van Tol"  wrote:

ian wrote: > I was once asked at an interview 'how many digits of PI do you
know?'.
If phrased like that, I would ask "Decimal?" and then answer "ten", 0..9.

-- 
Ruud


Re: Lovefilm, yes or no?

2010-04-14 Thread Ruud H.G. van Tol

ian wrote:


I was once asked at an interview 'how many digits of PI do you know?'.


If phrased like that, I would ask "Decimal?" and then answer "ten", 0..9.

--
Ruud



Re: Lovefilm, yes or no?

2010-04-14 Thread David Cantrell
On Wed, Apr 14, 2010 at 07:42:59PM +0200, Philip Newton wrote:
> On Wed, Apr 14, 2010 at 19:31, David Cantrell  wrote:
> > On Wed, Apr 14, 2010 at 07:16:18PM +0200, Abigail wrote:
> >> On Wed, Apr 14, 2010 at 04:23:48PM +0100, ian wrote:
> >> > I was once asked at an interview 'how many digits of PI do you know?'.
> >> "All of them - I just can't remember the order".
> > An infinitely long sequence of them, I just don't know where it starts.
> Ah - you have a proof that pi is normal, then! Just what
> mathematicians have been searching for for ages!

I thought it had been proven.  Ah well.

-- 
David Cantrell | Reality Engineer, Ministry of Information

Do not be afraid of cooking, as your ingredients will know and misbehave
   -- Fergus Henderson


Re: Lovefilm, yes or no?

2010-04-14 Thread Paul Makepeace
On Wed, Apr 14, 2010 at 10:29, Abigail  wrote:
> On Wed, Apr 14, 2010 at 09:47:14AM -0700, David Alban wrote:
>> On Wed, Apr 14, 2010 at 9:36 AM, Merijn Broeren  wrote:
>> > Does 128! end in a zero? If so, how many?
>>
>> i would think that any factorial N! would end in zero if N > 9.  but i
>> have no idea how many zeroes are at the end of <128!>.
>
>
> 5! multiples 2 and 5.
>
> The trick is to count the number of factors of 5.

It's worth noting explicitly that those factors of 5 work to create
trailing zeros because there is an excess of spare factors of 2 to
make 2*5=10.

>  floor (128 / 5) + floor (128 / 25) + floor (128 / 125) = 25 + 5 + 1 = 31.
>
>
> $ perl -E'$,="*";say 1..128'|bc|perl -0ne's/\D+//g;print/0+$/g'|wc -c
> 31

Nice. Mathematica,

Sum[Floor[128/5^k], {k, Floor[Log[5, 128]]}]
31

Log[5, 128] is the log base 5 of 128, i.e. the number you need to
raise 5 to to get 128 (=3.01...). The integer component of that
(Floor[]) gives you then the number of factors of five in 128 (=3).
The bit in the Sum[] is an iterator (k=1..3) creating a list {25, 5,
1} whose sum is 31.

Paul

> Abigail
>



Re: Lovefilm, yes or no?

2010-04-14 Thread Peter Corlett
On 14 Apr 2010, at 17:47, David Alban wrote:
> i would think that any factorial N! would end in zero if N > 9.  but i
> have no idea how many zeroes are at the end of <128!>.

Well, just give it a crack then. That's the point of the question, to see how 
people think. This one's particularly good because it's got several obvious 
answers, all of which are wrong, and it shows how hard people think.

The first thing to note is that multiples of ten have one zero, multiples of a 
hundred have two zeroes, and so on. So you are looking for all of the multiples 
of ten in the factorial.

The traps are not noticing that 2*5 = 10 - which you fell into - and that 10*10 
= 100.

The general idea is to realise that a factorial is also the product of the 
prime factors of each number. That is:

N! = 1 * 2 * 3 * 4 * 5 * 6 ...
   = 1 * 2 * 3 * 2*2 * 5 * 2*3 ...
   = 2**a * 3**b * 5**c * 7**d ...

And then to realise that a >= b >= c >= d, and so you care about the value of c 
(as there will always be enough twos to multiply by all the fives you can find 
to make tens.) 

So, there are int(128/5) = 25 multiples of five, int(128/5**2) = 5 multiples of 
25, and int(128/5**3) multiples of 125. So c = 25 + 5 + 1 = 31. So I reckon 
that 128! has 31 zeroes on the end.

Double-checking on a computer:

>>> reduce(lambda x, y: x * y, range(1,129)) % 10**31
0L
>>> reduce(lambda x, y: x * y, range(1,129)) % 10**32
8000L

There is probably some neat trick with logarithms to calculate the number of 
zeros at the end of arbitrary N!, but I'm not a mathematician.





Re: Lovefilm, yes or no?

2010-04-14 Thread Philip Newton
On Wed, Apr 14, 2010 at 19:31, David Cantrell  wrote:
> On Wed, Apr 14, 2010 at 07:16:18PM +0200, Abigail wrote:
>> On Wed, Apr 14, 2010 at 04:23:48PM +0100, ian wrote:
>> > I was once asked at an interview 'how many digits of PI do you know?'.
>> "All of them - I just can't remember the order".
>
> An infinitely long sequence of them, I just don't know where it starts.

Ah - you have a proof that pi is normal, then! Just what
mathematicians have been searching for for ages!

Cheers,
Philip
-- 
Philip Newton 


Re: Lovefilm, yes or no?

2010-04-14 Thread David Cantrell
On Wed, Apr 14, 2010 at 07:16:18PM +0200, Abigail wrote:
> On Wed, Apr 14, 2010 at 04:23:48PM +0100, ian wrote:
> > I was once asked at an interview 'how many digits of PI do you know?'.
> "All of them - I just can't remember the order".

An infinitely long sequence of them, I just don't know where it starts.

-- 
David Cantrell | even more awesome than a panda-fur coat

  I remember when computers were frustrating because they did
  exactly what you told them to.  That seems kinda quaint now.
  -- JD Baldwin, in the Monastery


Re: Lovefilm, yes or no?

2010-04-14 Thread Abigail
On Wed, Apr 14, 2010 at 09:47:14AM -0700, David Alban wrote:
> On Wed, Apr 14, 2010 at 9:36 AM, Merijn Broeren  wrote:
> > Does 128! end in a zero? If so, how many?
> 
> i would think that any factorial N! would end in zero if N > 9.  but i
> have no idea how many zeroes are at the end of <128!>.


5! multiples 2 and 5.

The trick is to count the number of factors of 5.


  floor (128 / 5) + floor (128 / 25) + floor (128 / 125) = 25 + 5 + 1 = 31.


$ perl -E'$,="*";say 1..128'|bc|perl -0ne's/\D+//g;print/0+$/g'|wc -c
31


Abigail


Re: Lovefilm, yes or no?

2010-04-14 Thread Abigail
On Wed, Apr 14, 2010 at 04:23:48PM +0100, ian wrote:
> On 14/04/2010 14:05, Peter Edwards wrote:
> ...
>>
>> I know a couple of people not on this list, one who joined in the last 6
>> months and seems happy enough there, another who interviewed for a perm job
>> a couple of weeks ago and didn't get it. You takes your pick...
>>
>> Funniest interview question I heard of recently (not Lovefilm) was:
>> "What's two to the power 14"
>> As in, work out the answer there and then, not type in  perl -e 'print
>> 2**14, "\n"'  as eny fule kno
>>
>> Cheers, Peter
>
> I was once asked at an interview 'how many digits of PI do you know?'.


"All of them - I just can't remember the order".



Abigail


Re: Lovefilm, yes or no?

2010-04-14 Thread Adrian Lai
On 14 April 2010 17:47, David Alban  wrote:
> i would think that any factorial N! would end in zero if N > 9.  but i
> have no idea how many zeroes are at the end of <128!>.

Surely you mean if N > 4?



Re: Lovefilm, yes or no?

2010-04-14 Thread David Alban
i would think that any factorial N! would end in zero if N > 9.  but i
have no idea how many zeroes are at the end of <128!>.
On Wed, Apr 14, 2010 at 9:36 AM, Merijn Broeren  wrote:
> Does 128! end in a zero? If so, how many?

-- 
Live in a world of your own, but always welcome visitors.


Re: Lovefilm, yes or no?

2010-04-14 Thread Merijn Broeren
Quoting Peter Edwards (pe...@dragonstaff.co.uk):
> 
> Funniest interview question I heard of recently (not Lovefilm) was:
> "What's two to the power 14"
> As in, work out the answer there and then, not type in  perl -e 'print
> 2**14, "\n"'  as eny fule kno
> 
Does 128! end in a zero? If so, how many? 

It's a quite a nice question to walk through to the end and it might
surprise you if you haven't seen it before. 

Cheers,
-- 
Merijn Broeren | We take risks, we know we take them. Therefore, when things
   | come out against us, we have no cause for complaint.
   | - Scott, last journal entry, march 1912


Re: Emergency social: The Gunmakers, tomorrow evening (for Perl 5.12.0)

2010-04-14 Thread Nicholas Clark
On Wed, Apr 14, 2010 at 04:41:52PM +0100, Nicholas Clark wrote:

>short of extraordinary rendition. Also, Damian is happy with the timing,
>as he completed the talk *before* the examples shown were still warnings
>free on the current version of Perl 5 :-)

Editing fail on my part.

'*before*' should be '*while*'.


And Damian's threat remains - his calendar remains nice and empty, giving
him plenty of time to write more EVIL, and upload it to CPAN.*

Nicholas Clark

* Your CPAN is at risk if you do not keep up payments.


Re: Emergency social: The Gunmakers, tomorrow evening (for Perl 5.12.0)

2010-04-14 Thread Jesse Vincent



On Wed, Apr 14, 2010 at 04:41:52PM +0100, Nicholas Clark wrote:
> Perl 5.12.0 escaped onto CPAN on Monday night, a few hours after Damian's 
> talk:
> 
> http://use.perl.org/article.pl?sid=10/04/13/1953252
> 
> Clearly this is an emergency. Although whether it's a good emergency or
> bad emergency is debatable. But either way, it requires a social.
> 
> The Gunmakers, Clerkenwell, Thursday 15th April 2010, from 6:30pm
> http://london.randomness.org.uk/wiki.cgi?Gunmakers%2C_EC1R_5ET
> 
> The food is good, the beer is good, and they've actually found a reason for
> Twitter to exist: https://twitter.com/thegunmakers

Sadly, I don't think I can make it.  Please have a pint for me!

-Jesse


Re: Lovefilm, yes or no?

2010-04-14 Thread Bob Walker

On Wed, 14 Apr 2010, ian wrote:


On 14/04/2010 14:05, Peter Edwards wrote:



I was once asked at an interview 'how many digits of PI do you know?'.



enough. although id much rather cancel pi out.
which is why it is useful to know that pi*(10^7) seconds = 363.610261 days
or approximately 1 year.

hmm pie. http://isitpie.com/




--
bob walker

buses should be purple and bendy




Emergency social: The Gunmakers, tomorrow evening (for Perl 5.12.0)

2010-04-14 Thread Nicholas Clark
Perl 5.12.0 escaped onto CPAN on Monday night, a few hours after Damian's talk:

http://use.perl.org/article.pl?sid=10/04/13/1953252

Clearly this is an emergency. Although whether it's a good emergency or
bad emergency is debatable. But either way, it requires a social.

The Gunmakers, Clerkenwell, Thursday 15th April 2010, from 6:30pm
http://london.randomness.org.uk/wiki.cgi?Gunmakers%2C_EC1R_5ET

The food is good, the beer is good, and they've actually found a reason for
Twitter to exist: https://twitter.com/thegunmakers


Just because the cause of the emergency is a four letter word doesn't mean
that we're likely to talk about it much. After all, off topic remains off
topic :-)

Nicholas Clark



PS Huge thanks to Jesse for herding cats for half a year to make this happen.
   (And big thanks to the all the cats involved in the herding process)
   Although time remains for Jesse to visit in person, it seems unlikely,
   short of extraordinary rendition. Also, Damian is happy with the timing,
   as he completed the talk *before* the examples shown were still warnings
   free on the current version of Perl 5 :-)


Re: Lovefilm, yes or no?

2010-04-14 Thread Joel Bernstein
On 14 April 2010 16:23, ian  wrote:
> I was once asked at an interview 'how many digits of PI do you know?'.

I would claim to know digits 100 to 150 and ask them to check
them for me as I recited...


Re: Lovefilm, yes or no?

2010-04-14 Thread ian

On 14/04/2010 14:05, Peter Edwards wrote:
...


I know a couple of people not on this list, one who joined in the last 6
months and seems happy enough there, another who interviewed for a perm job
a couple of weeks ago and didn't get it. You takes your pick...

Funniest interview question I heard of recently (not Lovefilm) was:
"What's two to the power 14"
As in, work out the answer there and then, not type in  perl -e 'print
2**14, "\n"'  as eny fule kno

Cheers, Peter


I was once asked at an interview 'how many digits of PI do you know?'.

At that time I could remember about 100 digits so I had a dilemma, would 
I do better in the interview if I recited all 100 or perhaps 10?


Another fact that sticks in my mind, and has been useful for the odd 
meeting where someone wants a back of fag-packet calulation, is that one 
million seconds is 11 days 13 hours 46 minutes and 40 seconds.


(and that 10,000,000 seconds is 115 days 17 hours 46 minutes and 40 
seconds).


Regards
Ian


Re: Lovefilm, yes or no?

2010-04-14 Thread Andy Armstrong
On 14 Apr 2010, at 16:06, Simon Cozens wrote:
> I guess I should be the first to point out that, not only are there
> people from Lovefilm reading this list, there are people from the BBC
> reading it too.


I /think/ that's just the Reith proxy - so it doesn't narrow it down too much :)

Wasn't me - that narrows it down a tad more.

-- 
Andy Armstrong, Hexten






Re: Lovefilm, yes or no?

2010-04-14 Thread Peter Edwards
On 14 April 2010 16:06, Simon Cozens  wrote:

>
> I guess I should be the first to point out that, not only are there
> people from Lovefilm reading this list, there are people from the BBC
> reading it too.
>

Not many people have access to the proxy logs to look up Purple Bunny's
X-Originating-IP, and anyway isn't having your employees push off for a more
tempting job all part and parcel of working life?

Cheers, Peter


Re: Lovefilm, yes or no?

2010-04-14 Thread Simon Cozens
On 14/04/2010 11:24, Pinky Weaselly wrote:
> Sorry for anon email, but I don't want to announce to my employer that I've 
> been approached by lovefilm about a job.

I guess I should be the first to point out that, not only are there
people from Lovefilm reading this list, there are people from the BBC
reading it too.

-- 
The best book on programming for the layman is "Alice in Wonderland";
but that's because it's the best book on anything for the layman.
- Alan Perlis


Re: Lovefilm, yes or no?

2010-04-14 Thread Lesley Binks
On Wed, Apr 14, 2010 at 04:14:17PM +0200, Jonathan McKeown wrote:
> On Wednesday 14 April 2010 15:05:51 Peter Edwards wrote:
> 
> > Funniest interview question I heard of recently (not Lovefilm) was:
> > "What's two to the power 14"
> > As in, work out the answer there and then
> 
> 2^10 (1024) is roughly 10^3, so 2^4 x 2^10 is roughly 16 thousand. If you 
> can't remember the power of two nearest to 16,000, you might have to work out 
> 16x24 and add it on - 240 plus 12x12.
> 
Well I was going to point out that 2^10 is 1K (i.e. 1024) and therefore 2^14 is
16K but resisted - until now.

I feel I should also contribute:

16*24 = 16*(25-1) = 4*4*25-16 = 400-16 = 384.

Therefore 2^14 = 16384.  QED

> It's a slightly odd question, i suppose, but not exactly hard. Perhaps i'm an 
> old fart, but I'd expect most programmers to be able to answer that almost 
> without pausing for breath.
> 
> (And I see Nick Clark has already answered while I was typing).
> 
> Jonathan


Re: Lovefilm, yes or no?

2010-04-14 Thread David Cantrell
On Wed, Apr 14, 2010 at 04:14:17PM +0200, Jonathan McKeown wrote:

> 2^10 (1024) is roughly 10^3, so 2^4 x 2^10 is roughly 16 thousand. If you 
> can't remember the power of two nearest to 16,000, you might have to work out 
> 16x24 and add it on - 240 plus 12x12.
> 
> It's a slightly odd question, i suppose, but not exactly hard. Perhaps i'm an 
> old fart, but I'd expect most programmers to be able to answer that almost 
> without pausing for breath.

If hexadecimal is acceptable, then I could answer 0x4000 straight away.
In decimal, I'd have to figger it out, as 65536 / 2 / 2.  But who uses
decimal for constants like that?

-- 
David Cantrell | Hero of the Information Age

  Irregular English:
ladies glow; gentlemen perspire; brutes, oafs and athletes sweat


Re: Lovefilm, yes or no?

2010-04-14 Thread Dave Hodgkinson

On 14 Apr 2010, at 22:03, Nicholas Clark wrote:

> On Wed, Apr 14, 2010 at 02:05:51PM +0100, Peter Edwards wrote:
> 
>> Funniest interview question I heard of recently (not Lovefilm) was:
>> "What's two to the power 14"
>> As in, work out the answer there and then, not type in  perl -e 'print
>> 2**14, "\n"'  as eny fule kno
> 
> 16384
> 
> (I admit that I did check that I can remember it correctly.)
> 
> 
> I'm starting to think that that's actually quite a good question really.

My Google phone interview (at 3am FFS) did a LOT of bit shifting type
questions.

-- 
Dave HodgkinsonMSN: daveh...@hotmail.com
Site: http://www.davehodgkinson.com  UK: +44 7768 490620
Blog: http://www.davehodgkinson.com/blog
Photos: http://www.flickr.com/photos/davehodg










Re: Lovefilm, yes or no?

2010-04-14 Thread Jonathan McKeown
On Wednesday 14 April 2010 15:05:51 Peter Edwards wrote:

> Funniest interview question I heard of recently (not Lovefilm) was:
> "What's two to the power 14"
> As in, work out the answer there and then

2^10 (1024) is roughly 10^3, so 2^4 x 2^10 is roughly 16 thousand. If you 
can't remember the power of two nearest to 16,000, you might have to work out 
16x24 and add it on - 240 plus 12x12.

It's a slightly odd question, i suppose, but not exactly hard. Perhaps i'm an 
old fart, but I'd expect most programmers to be able to answer that almost 
without pausing for breath.

(And I see Nick Clark has already answered while I was typing).

Jonathan


Re: Lovefilm, yes or no?

2010-04-14 Thread Nicholas Clark
On Wed, Apr 14, 2010 at 02:05:51PM +0100, Peter Edwards wrote:

> Funniest interview question I heard of recently (not Lovefilm) was:
> "What's two to the power 14"
> As in, work out the answer there and then, not type in  perl -e 'print
> 2**14, "\n"'  as eny fule kno

16384

(I admit that I did check that I can remember it correctly.)


I'm starting to think that that's actually quite a good question really.

Either they get it wrong
Or they get it right, but use paper to work it out
Or they get it right in their head

and even for the third case, how fast they answer is useful.
Did they just know it? Did they start from 65536 and halve twice?
Or did it take more mental arithmetic than that.


(Among other things, it's the address of the first byte of RAM on a ZX
Spectrum)

Nicholas Clark


Re: Lovefilm, yes or no?

2010-04-14 Thread Peter Edwards
On 14 April 2010 13:19, ian  wrote:

> There might be less comments to this thread if the people who have *not*
> been tested and rejected leave a comment.
>
> However, as a matter of interest, the test I took was the 'pelmanism' game
> (turning over cards to find a match).
>
> Has anyone been given a different test?
>

I know a couple of people not on this list, one who joined in the last 6
months and seems happy enough there, another who interviewed for a perm job
a couple of weeks ago and didn't get it. You takes your pick...

Funniest interview question I heard of recently (not Lovefilm) was:
"What's two to the power 14"
As in, work out the answer there and then, not type in  perl -e 'print
2**14, "\n"'  as eny fule kno

Cheers, Peter


Re: Lovefilm, yes or no?

2010-04-14 Thread ian
There might be less comments to this thread if the people who have *not* 
been tested and rejected leave a comment.


However, as a matter of interest, the test I took was the 'pelmanism' 
game (turning over cards to find a match).


Has anyone been given a different test?

Regards
Ian

On 14/04/2010 11:50, Dominic Thoreau wrote:

On 14 April 2010 11:24, Pinky Weaselly  wrote:


Sorry for anon email, but I don't want to announce to my employer that I've 
been approached by lovefilm about a job.

The recruiter started with "if I said 'lovefilm', would you say 'no'?"

Alarm bells are ringing. Can anyone say if they're a good employer, from a Perl 
perspective? You can email me privately if you like.


I don't know what it's like to actually work for them - I did a phone
interview, and their test (basically, write code fast, on
deadline).[1]

But they didn't hire me. After talking with previous colleagues (who
are better perl devs than I am - and didn't get hired either) I get
the opinion that they're trying to hire the elite - and almost to the
point of being snobbish about it.

As usual, YMMV


Dominic

[1] Without going into specifics of the task involved, they will ask
you to nominate a time in the future. At that time, their system will
arrange for an email to be delivered to you with a programming
assignment, which you have one hour to complete and return.




Re: Lovefilm, yes or no?

2010-04-14 Thread David Dorward
On 14 Apr 2010, at 11:50, Dominic Thoreau wrote:

> But they didn't hire me. After talking with previous colleagues (who
> are better perl devs than I am - and didn't get hired either) I get
> the opinion that they're trying to hire the elite - and almost to the
> point of being snobbish about it.


I also didn't get hired, but the impression I got was that they wanted people 
who were as good DBAs as they were Perl programmers. (My SQL wasn't up to 
scratch).

The location is also a bit out of the way (over in Acton IIRC).


-- 
David Dorward
http://dorward.me.uk




Re: Lovefilm, yes or no?

2010-04-14 Thread Dominic Thoreau
On 14 April 2010 11:24, Pinky Weaselly  wrote:
>
> Sorry for anon email, but I don't want to announce to my employer that I've 
> been approached by lovefilm about a job.
>
> The recruiter started with "if I said 'lovefilm', would you say 'no'?"
>
> Alarm bells are ringing. Can anyone say if they're a good employer, from a 
> Perl perspective? You can email me privately if you like.

I don't know what it's like to actually work for them - I did a phone
interview, and their test (basically, write code fast, on
deadline).[1]

But they didn't hire me. After talking with previous colleagues (who
are better perl devs than I am - and didn't get hired either) I get
the opinion that they're trying to hire the elite - and almost to the
point of being snobbish about it.

As usual, YMMV


Dominic

[1] Without going into specifics of the task involved, they will ask
you to nominate a time in the future. At that time, their system will
arrange for an email to be delivered to you with a programming
assignment, which you have one hour to complete and return.
-- 
Noli immiscere te draconum rebus nam fragilis es dentibus et cum garo
bene sapis.


Lovefilm, yes or no?

2010-04-14 Thread Pinky Weaselly

Sorry for anon email, but I don't want to announce to my employer that I've 
been approached by lovefilm about a job.

The recruiter started with "if I said 'lovefilm', would you say 'no'?"

Alarm bells are ringing. Can anyone say if they're a good employer, from a Perl 
perspective? You can email me privately if you like.

Pinky
  
_
http://clk.atdmt.com/UKM/go/19780/direct/01/
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now