OFFSET
0,2
COMMENTS
I.e., double (mod 5) each digit (0->0, 1->2, 2->4, 3->1, 4->3) of the base-5 representation of n.
First 5^n terms of the sequence form a permutation s(n) of 0..5^n-1, n >= 1; the number of inversions of s(n) is 3*(25^n-5^n)/20 (i.e., 3, 90, 2325, 58500, 1464375, ...). - Gheorghe Coserea, Apr 23 2018
LINKS
FORMULA
Generalized nim sum m + n in base q: write m and n in base q and add mod q with no carries, e.g., 5 + 8 in base 3 = "21" + "22" = "10" = 1.
MATHEMATICA
Array[FromDigits[IntegerDigits[#, 5] /. k_ :> Mod[2 k, 5], 5] &, 56, 0] (* Michael De Vlieger, Apr 27 2018 *)
PROG
(PARI)
a(n) = my(v=[0, 2, 4, 1, 3], b=#v); fromdigits(apply(d->v[d+1], digits(n, b)), b);
vector(56, n, a(n-1)) \\ Gheorghe Coserea, Apr 23 2018
CROSSREFS
KEYWORD
AUTHOR
STATUS
approved