A004515 Generalized nim sum n + n in base 5.
0, 2, 4, 1, 3, 10, 12, 14, 11, 13, 20, 22, 24, 21, 23, 5, 7, 9, 6, 8, 15, 17, 19, 16, 18, 50, 52, 54, 51, 53, 60, 62, 64, 61, 63, 70, 72, 74, 71, 73, 55, 57, 59, 56, 58, 65, 67, 69, 66, 68, 100, 102, 104, 101, 103, 110
Offset: 0
Links
Programs
-
Mathematica
Array[FromDigits[IntegerDigits[#, 5] /. k_ :> Mod[2 k, 5], 5] &, 56, 0] (* Michael De Vlieger, Apr 27 2018 *)
-
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
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.
Comments