#Haskell, 29 Using the formula from wikipedia. 1#_=1 n#k=mod((n-1)#k+k-1)n+1