3 ms·
Sure. A digit is "a symbol (a number symbol, e.g. "3" or "7") used in numerals (combinations of symbols, e.g. "37"), to represent numbers (integers or real num
by ckuehne 16y ago
Sure.
A digit is "a symbol (a number symbol, e.g. "3" or "7") used in numerals (combinations of symbols, e.g. "37"), to represent numbers (integers or real numbers) in positional numeral systems." (Source: Wikipedia)
For example, the number 17 consists of the digits 1 and 7.
So n digits of the Fibonacci sequence is ill-defined. Maybe a reasonable interpretation could be: n digits if you concatenate Fibonacci numbers. (At least, that was my working interpretation while reading the post until I realized that the OP had no idea what a digit is.) Since the question does not ask for the first n digits, you can choose any digit. I assume the Fibonacci sequence has n "1"s (actually I have no proof for that, but since the Fibonacci numbers are infinite it is reasonable assumption IMHO). Hence: print "1"*n
- raganwald 16y agoAh. I was hoping that the behaviour of "1"*n was interesting :-)
- colomon 16y agoHuh. I'm thinking I might very well not want to be hired by someone who doesn't know the difference between a digit and a number. What an odd thing...
- raganwald 16y agoAre you sure he doesn't know the difference? He may have banged out the post in a hurry. English may not be his first language. He may know the concepts very well but be unclear on the terms. If I were interviewing someone and they seemed to get the terms wrong, I would simply ask them "Do you mean number instead of digit?" If they sheepishly say, "Oh yeah!" I would carry on and forget about it. No big deal. You may have a different view, of course. But for me, getting this wrong is like getting the terms "pass by reference" and "pass reference by value" mixed up. It's worth clarifying, but hardly a sign someone is irredeemable :-)
- colomon 16y agoSure, it all depends on context. If I'm talking with someone and he's obviously knows what he's doing, then I'd certainly make allowances. At the same time, you'd certainly hope that an interviewer had the basic English-language terms down pat for one of his standard interview questions. (Presuming he's giving interviews in English, of course!) It's not a single mistake here, it's jumbled throughout the article in a fashion that makes the simple question sound much more complicated than it is. For what it's worth: my @fib := 0, 1, *+* ... *; my @fib-digits := @fib.map(*.comb).flat; Okay, I guess given an adequately expressive language, the problem still isn't very interesting even if you're really asking about the digits. :)