31
1
I don't like numbers, but I do like the Fibonacci sequence. I'm sure we could work something out.
Please read one integer n from STDIN and output the nth Fibonacci number in base 26 (abcdefghijklmnopqrstuvwxyz
instead of 0123456789
) to STDOUT.
The first Fibonacci number is 0. The second one is 1. The nth fibonacci number is the sum of the n-2nd and n-1st Fibonacci numbers.
First 32 fib-abc numbers:
fib(0) = a
fib(1) = b
fib(2) = b
fib(3) = c
fib(4) = d
fib(5) = f
fib(6) = i
fib(7) = n
fib(8) = v
fib(9) = bi
fib(10) = cd
fib(11) = dl
fib(12) = fo
fib(13) = iz
fib(14) = on
fib(15) = xm
fib(16) = blz
fib(17) = cjl
fib(18) = dvk
fib(19) = gev
fib(20) = kaf
fib(21) = qfa
fib(22) = baff
fib(23) = bqkf
fib(24) = cqpk
fib(25) = egzp
fib(26) = gxoz
fib(27) = leoo
fib(28) = scdn
fib(29) = bdgsb
fib(30) = bvivo
fib(31) = cypnp
This is code golf, so shortest code in bytes wins!
3@l0b0 you'd still call it base 26 because the choice of characters to represent the digits is entirely arbitrary and the common hexadecimal digits are just a convention. – Martin Ender – 2015-10-24T23:07:17.297
2It's still base26. What characters you use is arbitrary, and here we use a-z (in alphabetical order). – Filip Haglund – 2015-10-24T23:08:24.690
Right, it's a different base-26 notation from the conventional, but it's still a base-26 notation. – Lightness Races with Monica – 2015-10-25T02:05:44.720
5Why use them nasty numbers for the input? – ugoren – 2015-10-25T08:12:25.153
Name suggestion: Fibona-b-c – Matthew Roh – 2017-03-27T09:12:03.127