OFFSET
0,3
EXAMPLE
6! = 720 decimal = 435 tridecimal, so a(6) = 5.
MATHEMATICA
f[s_List] := Block[{a = s[[ -1]], len = Length@s}, Append[s, If[Mod[len, 13] == 0, Mod[a*len/13, 13], Mod[a*len, 13]]]]; Nest[f, {1}, 100] (* Robert G. Wilson v, May 03 2009 *)
f[n_] := Block[{id = IntegerDigits[n!, 13]}, While[id[[ -1]] == 0, id = Most@id]; id[[ -1]]]; Table[ f@n, {n, 0, 100}] (* Robert G. Wilson v, May 03 2009 *)
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Carl R. White, Jan 16 2008
STATUS
approved