# Brainbench perl test?

Piers Cawley pdcawley-london.0dd185 at bofh.org.uk
Tue Sep 4 14:12:06 BST 2012

```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.
>
>
>
> "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 :)
```