Brainbench perl test?

Avishalom Shalit avishalom at gmail.com
Tue Sep 4 14:20:37 BST 2012


I remember meeting someone who knew what the sequence was but forgot the
name.
Ended up calling it the  Fettucini sequence.
Bonus points.
-- vish




On 4 September 2012 14:12, Piers Cawley
<pdcawley-london.0dd185 at bofh.org.uk>wrote:

> On 4 September 2012 14:17, Dave Cross <dave at dave.org.uk> wrote:
> > Quoting Mr I <cub4ucme at gmail.com>:
> >
> >> Consider the example I gave. How will you approach that? I bet you'd
> >> approach completely differently if you KNEW vedic mathematics.
> >
> >
> > Your example said:
> >
> > "write a function ved(n, m) that implements the 16 sutras* and uses them
> to
> > return the result"
> >
> > That's not a usable specification. The original question was:
> >
> >
> > "Given that fib(n) is equal to fib(n-1) + fib(n-2) write a fib function
> in
> > any language"
> >
> > Can you not see the difference? It doesn't matter that it's a well-known
> > mathematical sequence. The required behaviour has been specified in the
> > question. It could be rewritten as:
> >
> > "Given that blarg(n) is equal to blarg(n-1) + blarg(n-2) write a blarg
> > function in any language"
>
> Or, in an attempt to really drive it home:
>
>     blarg(n) is equal to blarg( n - 1 ) * 2  +  blarg( n - 2 )
>
> There you go. Not the Fibonacci sequence, but still a recursive
> definition, trivially implementable with a recursive condition given a
> couple more bits of knowledge (the values of blarg(0) and blarg(1)).
> Entirely defined within its own terms and less likely to have the
> smart programmer supply a non-recursive or iterative function
> involving the golden ratio.
>
> > And it would still be solvable. Your question isn't a specification. It
> > can't be solved without guesswork.
>
> What Dave said.
>
> > And besides, I don't think I'd really want to work with a programmer who
> > didn't know what the Fibonacci sequence is :-)
>
> I dunno. Think of the teaching opportunities :)
>


More information about the london.pm mailing list