Skip to content

Instantly share code, notes, and snippets.

@mizchi
Created October 27, 2014 17:31
Show Gist options
  • Save mizchi/5076493ed27add299ade to your computer and use it in GitHub Desktop.
Save mizchi/5076493ed27add299ade to your computer and use it in GitHub Desktop.
# 問題: 5, 6, 7, 8, 9, 1, 0, 1, 1, 1, 2, 1, 3, ...
# という数列のn番目の数字を求める関数を書け
f = (n) -> n + 5
solve = (index)->
ret = ""
while true
ret += f(cnt++)
if ret.length > index
return ret[index]
console.log 'answer', solve(7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment